(t *testing.T)
| 1084 | } |
| 1085 | |
| 1086 | func TestAstIsChecked(t *testing.T) { |
| 1087 | env := testEnv(t) |
| 1088 | ast, iss := env.Compile("true") |
| 1089 | if iss.Err() != nil { |
| 1090 | t.Fatalf("e.Compile('true') failed: %v", iss.Err()) |
| 1091 | } |
| 1092 | if !ast.IsChecked() { |
| 1093 | t.Error("got ast.IsChecked() 'false', wanted 'true'.") |
| 1094 | } |
| 1095 | ce, err := AstToCheckedExpr(ast) |
| 1096 | if err != nil { |
| 1097 | t.Fatalf("AstToCheckedExpr(%v) failed: %v", ast, err) |
| 1098 | } |
| 1099 | ast2 := CheckedExprToAst(ce) |
| 1100 | if !ast2.IsChecked() { |
| 1101 | t.Error("got ast2.IsChecked() 'false', wanted 'true'") |
| 1102 | } |
| 1103 | if !proto.Equal(ast.Expr(), ast2.Expr()) { |
| 1104 | t.Errorf("AST exprs did not roundtrip properly: ast1: %v, ast2: %v", ast, ast2) |
| 1105 | } |
| 1106 | } |
| 1107 | |
| 1108 | func TestExhaustiveEval(t *testing.T) { |
| 1109 | env := testEnv(t, |
nothing calls this directly
no test coverage detected