mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Fix a broken test
This commit is contained in:
parent
319d777c56
commit
4d3eef299a
@ -13,6 +13,8 @@ func TestHighlightedTokensWithManPageHeading(t *testing.T) {
|
||||
textstyles.ManPageHeading = twin.StyleDefault.WithForeground(twin.NewColor16(2))
|
||||
|
||||
headingText := "JOHAN"
|
||||
|
||||
// For man page headings, this prefix should be ignored
|
||||
prefix := "X"
|
||||
|
||||
manPageHeading := ""
|
||||
@ -23,14 +25,9 @@ func TestHighlightedTokensWithManPageHeading(t *testing.T) {
|
||||
line := NewLine(manPageHeading)
|
||||
highlighted := line.HighlightedTokens(prefix, nil, nil)
|
||||
|
||||
assert.Equal(t, len(highlighted.Cells), len(headingText)+len(prefix))
|
||||
assert.Equal(t, len(highlighted.Cells), len(headingText))
|
||||
for i, cell := range highlighted.Cells {
|
||||
if i < len(prefix) {
|
||||
// Ignore the prefix when checking
|
||||
continue
|
||||
}
|
||||
|
||||
assert.Equal(t, cell.Rune, rune(headingText[i-len(prefix)]))
|
||||
assert.Equal(t, cell.Rune, rune(headingText[i]))
|
||||
assert.Equal(t, cell.Style, textstyles.ManPageHeading)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user