Read "// ERROR:" prefixed messages from the given file.
(t *testing.T, file string)
| 129 | |
| 130 | // Read "// ERROR:" prefixed messages from the given file. |
| 131 | func readErrorMessages(t *testing.T, file string) string { |
| 132 | data, err := os.ReadFile(file) |
| 133 | if err != nil { |
| 134 | t.Fatal("could not read input file:", err) |
| 135 | } |
| 136 | |
| 137 | var errors []string |
| 138 | for _, line := range strings.Split(string(data), "\n") { |
| 139 | if strings.HasPrefix(line, "// ERROR: ") { |
| 140 | errors = append(errors, strings.TrimRight(line[len("// ERROR: "):], "\r\n")) |
| 141 | } |
| 142 | } |
| 143 | return strings.Join(errors, "\n") |
| 144 | } |
no test coverage detected