diff --git a/cl/builtin_test.go b/cl/builtin_test.go index 7d14e476..c947bdd5 100644 --- a/cl/builtin_test.go +++ b/cl/builtin_test.go @@ -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?")