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)
params := types.NewTuple(types.NewParam(0, nil, "", callback))
sig := types.NewSignatureType(nil, nil, nil, params, nil, false)
ret1 := gt.cvtFunc(sig, false)
if ret1 == sig || gt.cvtFunc(sig, false) != ret1 {
t.Fatal("cvtFunc failed")
}
defer func() { defer func() {
if r := recover(); r == nil { if r := recover(); r == nil {
t.Log("cvtCType: no error?") t.Log("cvtType: no error?")
} }
}() }()
cvtGoType(typ) gt.cvtType(nil)
}
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)
_ = 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{}