| Josh Bleecher Snyder | 833a0f8 | 2025-04-24 18:39:36 +0000 | [diff] [blame] | 1 | Test adding a non-empty file to testdata when test expects empty files |
| 2 | |
| 3 | -- p_test.go -- |
| 4 | package p |
| 5 | |
| 6 | import ( |
| 7 | "os" |
| 8 | "path/filepath" |
| 9 | "testing" |
| 10 | ) |
| 11 | |
| 12 | func TestEmptyTestdata(t *testing.T) { |
| 13 | files, _ := filepath.Glob("testdata/*") |
| 14 | for _, path := range files { |
| 15 | data, _ := os.ReadFile(path) |
| 16 | if len(data) > 0 { |
| 17 | t.Fatalf("testdata file is not empty: %s", path) |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | -- testdata/empty -- |
| 23 | -- .commit -- |
| 24 | Initial commit with empty testdata file |
| 25 | |
| 26 | -- testdata/nonempty -- |
| 27 | hi |
| 28 | -- .commit -- |
| 29 | Add non-empty file to testdata |
| 30 | |
| 31 | -- .run_test -- |
| Josh Bleecher Snyder | ffecb1e | 2025-04-28 18:59:14 +0000 | [diff] [blame] | 32 | # Errors |
| 33 | |
| Josh Bleecher Snyder | 833a0f8 | 2025-04-24 18:39:36 +0000 | [diff] [blame] | 34 | Test regressions detected between initial commit (cdc9ec6dfb8669c11d8aa0df49c72112627784dc) and HEAD: |
| 35 | |
| 36 | 1: sketch.dev.TestEmptyTestdata: Was passing, now failing |
| 37 | |
| 38 | |
| 39 | Please fix before proceeding. |