blob: b754f3d273edaec0b2f0de04186668838d66b3fc [file] [log] [blame]
Josh Bleecher Snyder833a0f82025-04-24 18:39:36 +00001Test adding a non-empty file to testdata when test expects empty files
2
3-- p_test.go --
4package p
5
6import (
7 "os"
8 "path/filepath"
9 "testing"
10)
11
12func 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 --
24Initial commit with empty testdata file
25
26-- testdata/nonempty --
27hi
28-- .commit --
29Add non-empty file to testdata
30
31-- .run_test --
32Test regressions detected between initial commit (cdc9ec6dfb8669c11d8aa0df49c72112627784dc) and HEAD:
33
341: sketch.dev.TestEmptyTestdata: Was passing, now failing
35
36
37Please fix before proceeding.