MustParseJSONLines parses the lines containing JSON into the provided object.
(t *testing.T, lines []string, v any)
| 108 | |
| 109 | // MustParseJSONLines parses the lines containing JSON into the provided object. |
| 110 | func MustParseJSONLines(t *testing.T, lines []string, v any) { |
| 111 | t.Helper() |
| 112 | |
| 113 | allJSON := strings.Join(lines, "\n") |
| 114 | dec := json.NewDecoder(strings.NewReader(allJSON)) |
| 115 | dec.DisallowUnknownFields() |
| 116 | |
| 117 | if err := dec.Decode(v); err != nil { |
| 118 | t.Fatalf("failed to parse JSON %v: %v", allJSON, err) |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | // RunAllTestsWithParam uses reflection to run all test methods starting with 'Test' on the provided object. |
| 123 | // |