TestCvtType

This commit is contained in:
xushiwei
2024-05-05 13:56:24 +08:00
parent 0b131bd957
commit 6f679c05a3

View File

@@ -52,34 +52,23 @@ func TestIndexType(t *testing.T) {
indexType(types.Typ[types.Int]) indexType(types.Typ[types.Int])
} }
/* func TestCvtType(t *testing.T) {
func TestCvtCType(t *testing.T) { gt := newGoTypes()
test := func(typ types.Type) { callback := types.NewSignatureType(nil, nil, nil, nil, nil, false)
defer func() { params := types.NewTuple(types.NewParam(0, nil, "", callback))
if r := recover(); r == nil { sig := types.NewSignatureType(nil, nil, nil, params, nil, false)
t.Log("cvtCType: no error?") ret1 := gt.cvtFunc(sig, false)
} if ret1 == sig || gt.cvtFunc(sig, false) != ret1 {
}() t.Fatal("cvtFunc failed")
cvtGoType(typ)
} }
test(types.NewInterfaceType(nil, nil)) defer func() {
if r := recover(); r == nil {
a := types.NewTypeName(0, nil, "a", nil) t.Log("cvtType: no error?")
sig := types.NewSignatureType(nil, nil, nil, nil, nil, false) }
named := types.NewNamed(a, sig, nil) }()
test(named) gt.cvtType(nil)
} }
func TestCFuncPtr(t *testing.T) {
sig := types.NewSignatureType(nil, nil, nil, nil, nil, false)
csig := (*CFuncPtr)(sig)
_ = csig.String()
if csig.Underlying() != sig {
t.Fatal("TestCFuncPtr failed")
}
}
*/
func TestUserdefExpr(t *testing.T) { func TestUserdefExpr(t *testing.T) {
a := delayExprTy(nil) a := delayExprTy(nil)
b := &phisExprTy{} b := &phisExprTy{}