TestCvtCType

This commit is contained in:
xushiwei
2024-05-03 19:02:17 +08:00
parent 330cb22351
commit 91d012d33d
4 changed files with 67 additions and 1 deletions

View File

@@ -30,6 +30,23 @@ func TestMakeInterface(t *testing.T) {
}
*/
func TestCvtCType(t *testing.T) {
test := func(typ types.Type) {
defer func() {
if r := recover(); r == nil {
t.Log("cvtCType: no error?")
}
}()
cvtCType(typ)
}
test(types.NewInterfaceType(nil, nil))
a := types.NewTypeName(0, nil, "a", nil)
sig := types.NewSignatureType(nil, nil, nil, nil, nil, false)
named := types.NewNamed(a, sig, nil)
test(named)
}
func TestCFuncPtr(t *testing.T) {
sig := types.NewSignatureType(nil, nil, nil, nil, nil, false)
csig := (*CFuncPtr)(sig)