| 115 | } |
| 116 | |
| 117 | func TestIssues(t *testing.T) { |
| 118 | e, err := NewEnv() |
| 119 | if err != nil { |
| 120 | t.Fatalf("NewEnv() failed: %v", err) |
| 121 | } |
| 122 | _, iss := e.Compile("-") |
| 123 | _, iss2 := e.Compile("b") |
| 124 | iss = iss.Append(iss2) |
| 125 | if len(iss.Errors()) != 3 { |
| 126 | t.Errorf("iss.Errors() got %v, wanted 3 errors", iss.Errors()) |
| 127 | } |
| 128 | |
| 129 | wantIss := `ERROR: <input>:1:1: undeclared reference to 'b' (in container '') |
| 130 | | - |
| 131 | | ^ |
| 132 | ERROR: <input>:1:2: Syntax error: no viable alternative at input '-' |
| 133 | | - |
| 134 | | .^ |
| 135 | ERROR: <input>:1:2: Syntax error: mismatched input '<EOF>' expecting {'[', '{', '(', '.', '-', '!', 'true', 'false', 'null', NUM_FLOAT, NUM_INT, NUM_UINT, STRING, BYTES, IDENTIFIER} |
| 136 | | - |
| 137 | | .^` |
| 138 | if iss.String() != wantIss { |
| 139 | t.Errorf("iss.String() returned %v, wanted %v", iss.String(), wantIss) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | func TestFormatCELTypeEquivalence(t *testing.T) { |
| 144 | values := []*Type{ |