(t *testing.T)
| 290 | } |
| 291 | |
| 292 | func TestCustomEnv(t *testing.T) { |
| 293 | env, err := NewCustomEnv(Variable("a.b.c", BoolType)) |
| 294 | if err != nil { |
| 295 | t.Fatalf("NewCustomEnv(a.b.c:bool) failed: %v", err) |
| 296 | } |
| 297 | t.Run("err", func(t *testing.T) { |
| 298 | _, iss := compileOrError(t, env, "a.b.c == true") |
| 299 | if iss == nil { |
| 300 | t.Error("got successful compile, expected error for missing operator '_==_'") |
| 301 | } |
| 302 | }) |
| 303 | |
| 304 | t.Run("ok", func(t *testing.T) { |
| 305 | out, err := interpret(t, env, "a.b.c", map[string]any{"a.b.c": true}) |
| 306 | if err != nil { |
| 307 | t.Fatal(err) |
| 308 | } |
| 309 | if out != types.True { |
| 310 | t.Errorf("got '%v', wanted 'true'", out.Value()) |
| 311 | } |
| 312 | }) |
| 313 | } |
| 314 | |
| 315 | func TestCrossTypeNumericComparisons(t *testing.T) { |
| 316 | tests := []struct { |
nothing calls this directly
no test coverage detected