MCPcopy
hub / github.com/kopia/kopia / MustParseJSONLines

Function MustParseJSONLines

internal/testutil/testutil.go:110–120  ·  view source on GitHub ↗

MustParseJSONLines parses the lines containing JSON into the provided object.

(t *testing.T, lines []string, v any)

Source from the content-addressed store, hash-verified

108
109// MustParseJSONLines parses the lines containing JSON into the provided object.
110func 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//

Callers 15

TestRepoThrottleFunction · 0.92
TestSnapshotListFunction · 0.92
TestNotificationProfileFunction · 0.92
TestSnapshotStorageStatsFunction · 0.92
TestSnapshotVerifyFunction · 0.92
TestSnapshotPinFunction · 0.92
mustListSnapshotsFunction · 0.92

Calls 2

HelperMethod · 0.80
FatalfMethod · 0.80

Tested by 15

TestRepoThrottleFunction · 0.74
TestSnapshotListFunction · 0.74
TestNotificationProfileFunction · 0.74
TestSnapshotStorageStatsFunction · 0.74
TestSnapshotVerifyFunction · 0.74
TestSnapshotPinFunction · 0.74
mustListSnapshotsFunction · 0.74