(t *testing.T)
| 172 | } |
| 173 | |
| 174 | func TestCheckRulePositiveExtraFun(t *testing.T) { |
| 175 | tests := []ast.Clause{ |
| 176 | clause("foo(Y) :- bar(X) |> let Y = fn:plus(X, X), let _ = fn:ring_the_alarm()."), |
| 177 | } |
| 178 | for _, clause := range tests { |
| 179 | analyzer, _ := New(map[ast.PredicateSym]ast.Decl{ |
| 180 | ast.PredicateSym{"bar", 1}: makeSyntheticDecl(t, atom("bar(X)")), |
| 181 | }, nil, ErrorForBoundsMismatch) |
| 182 | analyzer.extraFunctions = map[ast.FunctionSym]ast.BaseTerm{ |
| 183 | ast.FunctionSym{"fn:ring_the_alarm", 0}: ast.AnyBound, |
| 184 | } |
| 185 | err := analyzer.CheckRule(clause) |
| 186 | if err != nil { |
| 187 | t.Errorf("Expected rule %v to be valid, got %v", clause, err) |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | func TestCheckRuleNegative(t *testing.T) { |
| 193 | tests := []ast.Clause{ |
nothing calls this directly
no test coverage detected