MCPcopy
hub / github.com/google/mangle / TestDeclPackage

Function TestDeclPackage

ast/ast_test.go:565–585  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

563}
564
565func TestDeclPackage(t *testing.T) {
566 tests := []struct {
567 predicate string
568 want string
569 }{
570 {predicate: "bar", want: ""},
571 {predicate: "foo.bar", want: "foo"},
572 {predicate: "foo.baz.bar", want: "foo.baz"},
573 }
574 for _, test := range tests {
575 decl := makeSyntheticDecl(t, NewQuery(PredicateSym{test.predicate, 1}))
576
577 if got := decl.PackageID(); got != test.want {
578 t.Fatalf("PackageID(%v)=%v want %v", decl, got, test.want)
579 }
580
581 if !decl.IsSynthetic() {
582 t.Fatalf("(%v).IsSynthetic() = false want true", decl)
583 }
584 }
585}
586
587func TestDeclPackageDecl(t *testing.T) {
588 tests := []string{

Callers

nothing calls this directly

Calls 4

NewQueryFunction · 0.85
PackageIDMethod · 0.80
IsSyntheticMethod · 0.80
makeSyntheticDeclFunction · 0.70

Tested by

no test coverage detected