(t *testing.T)
| 1169 | } |
| 1170 | |
| 1171 | func TestAstIsChecked(t *testing.T) { |
| 1172 | env := testEnv(t) |
| 1173 | ast, iss := env.Compile("true") |
| 1174 | if iss.Err() != nil { |
| 1175 | t.Fatalf("e.Compile('true') failed: %v", iss.Err()) |
| 1176 | } |
| 1177 | if !ast.IsChecked() { |
| 1178 | t.Error("got ast.IsChecked() 'false', wanted 'true'.") |
| 1179 | } |
| 1180 | ce, err := AstToCheckedExpr(ast) |
| 1181 | if err != nil { |
| 1182 | t.Fatalf("AstToCheckedExpr(%v) failed: %v", ast, err) |
| 1183 | } |
| 1184 | ast2 := CheckedExprToAst(ce) |
| 1185 | if !ast2.IsChecked() { |
| 1186 | t.Error("got ast2.IsChecked() 'false', wanted 'true'") |
| 1187 | } |
| 1188 | if !proto.Equal(ast.Expr(), ast2.Expr()) { |
| 1189 | t.Errorf("AST exprs did not roundtrip properly: ast1: %v, ast2: %v", ast, ast2) |
| 1190 | } |
| 1191 | } |
| 1192 | |
| 1193 | func TestExhaustiveEval(t *testing.T) { |
| 1194 | env := testEnv(t, |
nothing calls this directly
no test coverage detected