TestTypes
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -91,9 +91,11 @@ type aType struct {
|
||||
|
||||
type Type = *aType
|
||||
|
||||
/*
|
||||
func (p Program) Slice(typ Type) Type {
|
||||
return p.Type(types.NewSlice(typ.t))
|
||||
}
|
||||
*/
|
||||
|
||||
func (p Program) Pointer(typ Type) Type {
|
||||
return p.Type(types.NewPointer(typ.t))
|
||||
|
||||
Reference in New Issue
Block a user