(t *testing.T)
| 281 | } |
| 282 | |
| 283 | func TestLibraries(t *testing.T) { |
| 284 | e, err := NewEnv(OptionalTypes()) |
| 285 | if err != nil { |
| 286 | t.Fatalf("NewEnv() failed: %v", err) |
| 287 | } |
| 288 | for _, expected := range []string{"cel.lib.std", "cel.lib.optional"} { |
| 289 | if !e.HasLibrary(expected) { |
| 290 | t.Errorf("Expected HasLibrary() to return true for '%s'", expected) |
| 291 | } |
| 292 | libMap := map[string]struct{}{} |
| 293 | libraries := e.Libraries() |
| 294 | for _, lib := range libraries { |
| 295 | libMap[lib] = struct{}{} |
| 296 | } |
| 297 | if len(libraries) != 2 { |
| 298 | t.Errorf("Expected HasLibrary() to contain exactly 2 libraries but got: %v", libraries) |
| 299 | } |
| 300 | |
| 301 | if _, ok := libMap[expected]; !ok { |
| 302 | t.Errorf("Expected Libraries() to include '%s'", expected) |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | func TestFunctions(t *testing.T) { |
| 308 | e, err := NewEnv(OptionalTypes()) |
nothing calls this directly
no test coverage detected