mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +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:
parent
eafb70d790
commit
9ee1d18ab5
@ -48,3 +48,27 @@ func TestConsumeEncodedEventWithNoInput(t *testing.T) {
|
|||||||
assert.Assert(t, event == nil)
|
assert.Assert(t, event == nil)
|
||||||
assert.Equal(t, remainder, "")
|
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 := "[m"
|
||||||
|
reversed := "[7m"
|
||||||
|
notReversed := "[27m"
|
||||||
|
dim := "[2m"
|
||||||
|
clearToEol := "[K"
|
||||||
|
assert.Equal(t,
|
||||||
|
strings.ReplaceAll(rendered, "", "ESC"),
|
||||||
|
strings.ReplaceAll(reset+reversed+"<"+dim+notReversed+"f"+clearToEol+reset, "", "ESC"))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user