blob: 7c2be2de0edee2044d88cdcf1717791a61d73548 [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 Snyder833a0f82025-04-24 18:39:36 +000034Test regressions detected between initial commit (cdc9ec6dfb8669c11d8aa0df49c72112627784dc) and HEAD:
35
361: sketch.dev.TestEmptyTestdata: Was passing, now failing
37
38
39Please fix before proceeding.