(t *testing.T)
| 1064 | } |
| 1065 | |
| 1066 | func TestAstIsChecked(t *testing.T) { |
| 1067 | env := testEnv(t) |
| 1068 | ast, iss := env.Compile("true") |
| 1069 | if iss.Err() != nil { |
| 1070 | t.Fatalf("e.Compile('true') failed: %v", iss.Err()) |
| 1071 | } |
| 1072 | if !ast.IsChecked() { |
| 1073 | t.Error("got ast.IsChecked() 'false', wanted 'true'.") |
| 1074 | } |
| 1075 | ce, err := AstToCheckedExpr(ast) |
| 1076 | if err != nil { |
| 1077 | t.Fatalf("AstToCheckedExpr(%v) failed: %v", ast, err) |
| 1078 | } |
| 1079 | ast2 := CheckedExprToAst(ce) |
| 1080 | if !ast2.IsChecked() { |
| 1081 | t.Error("got ast2.IsChecked() 'false', wanted 'true'") |
| 1082 | } |
| 1083 | if !proto.Equal(ast.Expr(), ast2.Expr()) { |
| 1084 | t.Errorf("AST exprs did not roundtrip properly: ast1: %v, ast2: %v", ast, ast2) |
| 1085 | } |
| 1086 | } |
| 1087 | |
| 1088 | func TestExhaustiveEval(t *testing.T) { |
| 1089 | env := testEnv(t, |
nothing calls this directly
no test coverage detected