1
1
mirror of https://github.com/walles/moar.git synced 2024-08-16 23:40:35 +03:00

Add another test

Turns out the thing I worried about wasn't moar's fault, but this test
is still valid so let's keep it.

Ref: https://gitlab.com/gnachman/iterm2/issues/10862
This commit is contained in:
Johan Walles 2023-03-23 22:42:40 +01:00
parent eafb70d790
commit 9ee1d18ab5

View File

@ -48,3 +48,27 @@ func TestConsumeEncodedEventWithNoInput(t *testing.T) {
assert.Assert(t, event == nil)
assert.Equal(t, remainder, "")
}
func TestRenderLine(t *testing.T) {
row := []Cell{
{
Rune: '<',
Style: StyleDefault.WithAttr(AttrReverse),
},
{
Rune: 'f',
Style: StyleDefault.WithAttr(AttrDim),
},
}
rendered, count := renderLine(row)
assert.Equal(t, count, 2)
reset := ""
reversed := ""
notReversed := ""
dim := ""
clearToEol := ""
assert.Equal(t,
strings.ReplaceAll(rendered, "", "ESC"),
strings.ReplaceAll(reset+reversed+"<"+dim+notReversed+"f"+clearToEol+reset, "", "ESC"))
}