@@ -113,6 +113,7 @@ func checkFsTestError(t *testing.T, err error, files map[string]string) {
113
113
}
114
114
// filter lines from the error text corresponding to the above errors;
115
115
// output looks like:
116
+ // TestFS found errors:
116
117
// bar.txt: mismatch:
117
118
// entry.Info() = bar.txt IsDir=false Mode=-rw-rw-rw- Size=14 ModTime=2024-09-17 10:09:00.377023639 +0000 UTC m=+0.002625548
118
119
// file.Stat() = bar.txt IsDir=false Mode=-rw-rw-rw- Size=14 ModTime=2024-09-17 10:09:00.376907011 +0000 UTC m=+0.002508970
@@ -124,19 +125,22 @@ func checkFsTestError(t *testing.T, err error, files map[string]string) {
124
125
// We filter on "empty line" or "ModTime" or "$filename: mismatch" to ignore these.
125
126
lines := strings .Split (err .Error (), "\n " )
126
127
filtered := make ([]string , 0 , len (lines ))
127
- filename_mismatches := make (map [string ]struct {}, len (files ) * 2 )
128
- for name , _ := range files {
128
+ filename_mismatches := make (map [string ]struct {}, len (files )* 2 )
129
+ for name := range files {
129
130
for dirname := name ; dirname != "." ; dirname = filepath .Dir (dirname ) {
130
- filename_mismatches [dirname + ": mismatch:" ] = struct {}{}
131
+ filename_mismatches [dirname + ": mismatch:" ] = struct {}{}
131
132
}
132
133
}
134
+ if strings .TrimSpace (lines [0 ]) == "TestFS found errors:" {
135
+ lines = lines [1 :]
136
+ }
133
137
for _ , line := range lines {
134
- line = strings .TrimSpace (line )
135
- if line == "" || strings .Contains (line , "ModTime=" ) {
138
+ trimmed : = strings .TrimSpace (line )
139
+ if trimmed == "" || strings .Contains (trimmed , "ModTime=" ) {
136
140
continue
137
141
}
138
142
139
- if _ , ok := filename_mismatches [line ]; ok {
143
+ if _ , ok := filename_mismatches [trimmed ]; ok {
140
144
continue
141
145
}
142
146
filtered = append (filtered , line )
0 commit comments