(t *testing.T, path string, into interface{})
| 252 | } |
| 253 | |
| 254 | func readFileToStruct(t *testing.T, path string, into interface{}) { |
| 255 | bytes, err := ioutil.ReadFile(path) |
| 256 | if err != nil { |
| 257 | t.Fatalf("Failed to read test file from %s: %s", path, err.Error()) |
| 258 | } |
| 259 | err = yaml.Unmarshal(bytes, into) |
| 260 | if err != nil { |
| 261 | t.Fatalf("Failed to unmarshal file into struct: %s", err.Error()) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | // Since order of error message lines is not deterministic, it's necessary to compare |
| 266 | // in a weaker way than asserting string equality. |
no test coverage detected