Files
cheat/internal/display/indent_test.go
Christopher Allen Lane ca1ec0e38d 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>
2026-02-15 16:35:12 -05:00

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)
}
}