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