blob: 6b6a1bbc5772a1f49786ace664c9548f2a5ebd00 [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 --
Josh Bleecher Snyderffecb1e2025-04-28 18:59:14 +000032# Errors
33
Josh Bleecher Snyder2fde4652025-05-01 17:50:34 -070034Test regressions detected between initial commit (INITIAL_COMMIT_HASH) and HEAD:
Josh Bleecher Snyder833a0f82025-04-24 18:39:36 +000035
361: sketch.dev.TestEmptyTestdata: Was passing, now failing
37
38
39Please fix before proceeding.