(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestCheckmake_RunWithViolations(t *testing.T) { |
| 79 | cmd := newRootCmd() |
| 80 | cmd.SilenceErrors = true |
| 81 | cmd.SetArgs([]string{"../../fixtures/missing_phony.make"}) |
| 82 | |
| 83 | var err error |
| 84 | out := captureOutput(func() { |
| 85 | err = cmd.Execute() |
| 86 | }) |
| 87 | |
| 88 | require.Error(t, err, "expected command to fail for a makefile with violations") |
| 89 | |
| 90 | // matching full sentences with table output is complex, search partially |
| 91 | assert.Contains(t, out, "Required target", "should mention violation description") |
| 92 | assert.Contains(t, out, "declared PHONY.", "should mention target type") |
| 93 | assert.Contains(t, out, "phonydeclared", "should mention phonydeclared error") |
| 94 | } |
| 95 | |
| 96 | func TestCheckmake_ListRules(t *testing.T) { |
| 97 | t.Parallel() |
nothing calls this directly
no test coverage detected