MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestIssues

Function TestIssues

cel/env_test.go:117–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func 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 | ^
132ERROR: <input>:1:2: Syntax error: no viable alternative at input '-'
133 | -
134 | .^
135ERROR: <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
143func TestFormatCELTypeEquivalence(t *testing.T) {
144 values := []*Type{

Callers

nothing calls this directly

Calls 5

CompileMethod · 0.95
ErrorsMethod · 0.80
NewEnvFunction · 0.70
StringMethod · 0.65
AppendMethod · 0.45

Tested by

no test coverage detected