(t *testing.T)
| 550 | } |
| 551 | |
| 552 | func TestFindYamlFilesNonRecursive(t *testing.T) { |
| 553 | dir := t.TempDir() |
| 554 | |
| 555 | // Create a YAML file in the root dir |
| 556 | rootYAML, err := os.Create(filepath.Join(dir, "root.yaml")) //nolint:gosec |
| 557 | require.NoError(t, err) |
| 558 | defer rootYAML.Close() |
| 559 | |
| 560 | // Create a subdirectory with a YAML file inside it |
| 561 | subdir := filepath.Join(dir, "nested") |
| 562 | require.NoError(t, os.Mkdir(subdir, 0o750)) |
| 563 | |
| 564 | nestedYML, err := os.Create(filepath.Join(subdir, "nested.yml")) //nolint:gosec |
| 565 | require.NoError(t, err) |
| 566 | defer nestedYML.Close() |
| 567 | |
| 568 | files, err := findYamlFiles(dir) |
| 569 | require.NoError(t, err) |
| 570 | // Should only include files directly under dir, not nested ones |
| 571 | assert.ElementsMatch(t, []string{rootYAML.Name()}, files) |
| 572 | } |
| 573 | |
| 574 | func writeEntry(t *testing.T, dir string, entry *Entry, ext string) { |
| 575 | require.Contains(t, []string{"yaml", "yml"}, ext, "ext must be 'yaml' or 'yml'") |
nothing calls this directly
no test coverage detected