TestLoadIgnoresNonYAMLFiles confirms the loader's filter — a stray README.md or .json file in config/specs shouldn't trip the parser.
(t *testing.T)
| 238 | // TestLoadIgnoresNonYAMLFiles confirms the loader's filter — a stray |
| 239 | // README.md or .json file in config/specs shouldn't trip the parser. |
| 240 | func TestLoadIgnoresNonYAMLFiles(t *testing.T) { |
| 241 | dir := t.TempDir() |
| 242 | if err := os.WriteFile(filepath.Join(dir, "README.md"), []byte("# notes"), 0o644); err != nil { |
| 243 | t.Fatal(err) |
| 244 | } |
| 245 | if err := os.WriteFile(filepath.Join(dir, "notes.txt"), []byte("ignore me"), 0o644); err != nil { |
| 246 | t.Fatal(err) |
| 247 | } |
| 248 | res, err := Load(LoaderOptions{SpecsDir: dir}, nil, nil) |
| 249 | if err != nil { |
| 250 | t.Fatalf("Load: %v", err) |
| 251 | } |
| 252 | if len(res.Registry.Specs) != 0 { |
| 253 | t.Errorf("expected 0 specs, got %d", len(res.Registry.Specs)) |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // TestLoadParseErrorIsWarning confirms a malformed spec produces a |
| 258 | // warning rather than aborting load — other specs should still be |