mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 11:13:33 +01:00
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>
23 lines
597 B
Go
23 lines
597 B
Go
package display
|
|
|
|
import "testing"
|
|
|
|
// TestIndent asserts that Indent prepends a tab to each line
|
|
func TestIndent(t *testing.T) {
|
|
got := Indent("foo\nbar\nbaz")
|
|
want := "\tfoo\n\tbar\n\tbaz\n"
|
|
if got != want {
|
|
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)
|
|
}
|
|
}
|