(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestRewriteClauseInputMode(t *testing.T) { |
| 50 | d, err := ast.NewDecl( |
| 51 | atom("bar(Z)"), |
| 52 | []ast.Atom{ |
| 53 | atom("reflects(/bar)"), |
| 54 | atom("mode('+')"), |
| 55 | }, |
| 56 | []ast.BoundDecl{ast.NewBoundDecl(name("/bar"))}, |
| 57 | nil) |
| 58 | if err != nil { |
| 59 | t.Fatal(err) |
| 60 | } |
| 61 | decls := map[ast.PredicateSym]*ast.Decl{ast.PredicateSym{"bar", 1}: &d} |
| 62 | clause := clause("foo(X) :- bar(X).") |
| 63 | got := RewriteClause(decls, clause) |
| 64 | want := atom(":match_prefix(X, /bar)") |
| 65 | if len(got.Premises) != 1 || !got.Premises[0].Equals(want) { |
| 66 | t.Errorf("RewriteClause(%v, %v)=%v want %v", decls, clause, got, want) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | func TestRewriteClauseDefinedPreviously(t *testing.T) { |
| 71 | scanDecl, err := ast.NewSyntheticDecl(atom("scan(X)")) |
nothing calls this directly
no test coverage detected