MCPcopy Create free account
hub / github.com/checkmake/checkmake / TestJSONFormatter_EmptyViolations

Function TestJSONFormatter_EmptyViolations

formatters/json_test.go:55–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestJSONFormatter_EmptyViolations(t *testing.T) {
56 out := new(bytes.Buffer)
57 formatter := JSONFormatter{out: out}
58
59 var violations []struct {
60 Rule string `json:"rule"`
61 Violation string `json:"violation"`
62 FileName string `json:"file_name"`
63 LineNumber int `json:"line_number"`
64 }
65
66 formatter.Format(rules.RuleViolationList{})
67
68 err := json.Unmarshal(out.Bytes(), &violations)
69 require.NoError(t, err, "output should be valid JSON even with no violations")
70 assert.Equal(t, 0, len(violations), "should have empty array for no violations")
71}

Callers

nothing calls this directly

Calls 1

FormatMethod · 0.95

Tested by

no test coverage detected