(t *testing.T)
| 422 | } |
| 423 | |
| 424 | func TestLibraries(t *testing.T) { |
| 425 | e, err := NewEnv(OptionalTypes()) |
| 426 | if err != nil { |
| 427 | t.Fatalf("NewEnv() failed: %v", err) |
| 428 | } |
| 429 | for _, expected := range []string{"cel.lib.std", "cel.lib.optional"} { |
| 430 | if !e.HasLibrary(expected) { |
| 431 | t.Errorf("Expected HasLibrary() to return true for '%s'", expected) |
| 432 | } |
| 433 | libMap := map[string]struct{}{} |
| 434 | libraries := e.Libraries() |
| 435 | for _, lib := range libraries { |
| 436 | libMap[lib] = struct{}{} |
| 437 | } |
| 438 | if len(libraries) != 2 { |
| 439 | t.Errorf("Expected HasLibrary() to contain exactly 2 libraries but got: %v", libraries) |
| 440 | } |
| 441 | |
| 442 | if _, ok := libMap[expected]; !ok { |
| 443 | t.Errorf("Expected Libraries() to include '%s'", expected) |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | func TestFunctions(t *testing.T) { |
| 449 | e, err := NewEnv(OptionalTypes()) |
nothing calls this directly
no test coverage detected