1
1
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:
Johan Walles 2024-01-10 17:29:25 +01:00
parent 319d777c56
commit 4d3eef299a

View File

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