check checks that the file contains txt and does not contain notxt.
(t *testing.T, l *log, txt, notxt string)
| 127 | |
| 128 | // check checks that the file contains txt and does not contain notxt. |
| 129 | func check(t *testing.T, l *log, txt, notxt string) { |
| 130 | t.Helper() |
| 131 | contents, err := os.ReadFile(l.file.Name()) |
| 132 | if err != nil { |
| 133 | t.Fatal(err) |
| 134 | } |
| 135 | if txt != "" && !bytes.Contains(contents, []byte(txt)) { |
| 136 | t.Fatalf("%s does not contain %s", contents, txt) |
| 137 | } |
| 138 | if notxt != "" && bytes.Contains(contents, []byte(notxt)) { |
| 139 | t.Fatalf("%s does contain %s", contents, notxt) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // checkWait is like check, but if the file is empty, |
| 144 | // it waits until it's not. |
no test coverage detected
searching dependent graphs…