TestTypes

This commit is contained in:
xushiwei
2024-05-03 19:20:30 +08:00
parent b615ada2c3
commit 424dbd9261
2 changed files with 24 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ import (
"go/token"
"go/types"
"testing"
"github.com/goplus/llvm"
)
/*
@@ -30,6 +32,26 @@ func TestMakeInterface(t *testing.T) {
}
*/
func TestTypes(t *testing.T) {
ctx := llvm.NewContext()
llvmIntType(ctx, 4)
intT := types.NewVar(0, nil, "", types.Typ[types.Int])
ret := types.NewTuple(intT, intT)
sig := types.NewSignatureType(nil, nil, nil, nil, ret, false)
prog := NewProgram(nil)
prog.retType(sig)
}
func TestIndexType(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Log("indexType: no error?")
}
}()
indexType(types.Typ[types.Int])
}
func TestCvtCType(t *testing.T) {
test := func(typ types.Type) {
defer func() {