mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 03:03:32 +01:00
test: improve mutation coverage across 4 modules
Mutation testing (56 mutations, 10 modules) identified 7 surviving mutations. Added 5 targeted tests to kill all actionable survivors. Remaining 2 are logically equivalent condition reorderings in filter.go. Overall mutation score: 96.4%. New tests: - TestHasMalformedYAML: YAML unmarshal error path - TestInvalidateInvalidCheatpath: cheatpath.Validate() delegation - TestIndentTrimsWhitespace: TrimSpace behavior - TestColorizeDefaultSyntax: default "bash" lexer - TestColorizeExplicitSyntax: lexer differentiation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,3 +10,13 @@ func TestIndent(t *testing.T) {
|
||||
t.Errorf("failed to indent: want: %s, got: %s", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestIndentTrimsWhitespace asserts that Indent trims leading and trailing
|
||||
// whitespace before indenting
|
||||
func TestIndentTrimsWhitespace(t *testing.T) {
|
||||
got := Indent(" foo\nbar\nbaz \n")
|
||||
want := "\tfoo\n\tbar\n\tbaz\n"
|
||||
if got != want {
|
||||
t.Errorf("failed to trim and indent: want: %q, got: %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user