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

Function TestCheckmake_WithJSONOutputFlag

cmd/checkmake/main_test.go:258–281  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

256}
257
258func TestCheckmake_WithJSONOutputFlag(t *testing.T) {
259 out := captureOutput(func() {
260 cmd := newRootCmd()
261 cmd.SilenceErrors = true
262 cmd.SetArgs([]string{
263 "--output", "json",
264 "../../fixtures/missing_phony.make",
265 })
266 _ = cmd.Execute()
267 })
268
269 require.NotEmpty(t, out, "output should not be empty for JSON format")
270
271 // Verify it's valid JSON
272 var violations []struct {
273 Rule string `json:"rule"`
274 Violation string `json:"violation"`
275 FileName string `json:"file_name"`
276 LineNumber int `json:"line_number"`
277 }
278
279 err := json.Unmarshal([]byte(out), &violations)
280 require.NoError(t, err, "output should be valid JSON")
281}
282
283func TestCheckmake_WithTextOutput(t *testing.T) {
284 out := captureOutput(func() {

Callers

nothing calls this directly

Calls 2

captureOutputFunction · 0.85
newRootCmdFunction · 0.85

Tested by

no test coverage detected