TestCvtCType
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -82,7 +82,7 @@ func cvtCType(typ types.Type) (types.Type, bool) {
|
||||
return cvtCStruct(t)
|
||||
case *types.Named:
|
||||
if _, cvt := cvtCType(t.Underlying()); cvt {
|
||||
panic("todo: named type")
|
||||
panic("don't define named type")
|
||||
}
|
||||
case *types.Signature:
|
||||
t = CFuncDecl(t)
|
||||
|
||||
Reference in New Issue
Block a user