Skip to content

Commit

Permalink
Add man page formatting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Oct 30, 2019
1 parent ad0f174 commit a4ec70f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions m/ansiTokenizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ func TestTokenize(t *testing.T) {
}
}

func testManPages(t *testing.T) {
// Bold
tokens, _ := TokensFromString(nil, "ab\bbc")
assert.Equal(t, []Token{
Token{Rune: 'a', Style: tcell.StyleDefault},
Token{Rune: 'b', Style: tcell.StyleDefault.Bold(true)},
Token{Rune: 'c', Style: tcell.StyleDefault},
}, tokens)

// Underline
tokens, _ = TokensFromString(nil, "ab\b_c")
assert.Equal(t, []Token{
Token{Rune: 'a', Style: tcell.StyleDefault},
Token{Rune: 'b', Style: tcell.StyleDefault.Underline(true)},
Token{Rune: 'c', Style: tcell.StyleDefault},
}, tokens)
}

func TestConsumeCompositeColorHappy(t *testing.T) {
// 8 bit color
// Example from: https://github.com/walles/moar/issues/14
Expand Down

0 comments on commit a4ec70f

Please sign in to comment.