TestPkgKindOf
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package cl
|
||||
|
||||
import (
|
||||
"go/constant"
|
||||
"go/types"
|
||||
"testing"
|
||||
|
||||
@@ -44,6 +45,21 @@ func TestPkgKind(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPkgKindOf(t *testing.T) {
|
||||
if v := PkgKindOf(types.Unsafe); v != PkgDeclOnly {
|
||||
t.Fatal("PkgKindOf unsafe:", v)
|
||||
}
|
||||
pkg := types.NewPackage("foo", "foo")
|
||||
pkg.Scope().Insert(
|
||||
types.NewConst(
|
||||
0, pkg, "LLGoPackage", types.Typ[types.String],
|
||||
constant.MakeString("noinit")),
|
||||
)
|
||||
if v := PkgKindOf(pkg); v != PkgNoInit {
|
||||
t.Fatal("PkgKindOf foo:", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsAny(t *testing.T) {
|
||||
if isAny(types.Typ[types.UntypedInt]) {
|
||||
t.Fatal("isAny?")
|
||||
|
||||
Reference in New Issue
Block a user