1
1
mirror of https://github.com/walles/moar.git synced 2024-11-22 21:50:43 +03:00

Test another corner case

It worked!
This commit is contained in:
Johan Walles 2023-10-10 06:18:03 +02:00
parent a082fe207e
commit 8478883821

View File

@ -91,7 +91,7 @@ func TestRenderLineLastReversed(t *testing.T) {
strings.ReplaceAll(reset+reversed+"<"+reset+clearToEol, "", "ESC"))
}
func TestRenderLineLastReversedPlusTrailingSpaces(t *testing.T) {
func TestRenderLineLastReversedPlusTrailingSpace(t *testing.T) {
row := []Cell{
{
Rune: '<',
@ -112,3 +112,21 @@ func TestRenderLineLastReversedPlusTrailingSpaces(t *testing.T) {
strings.ReplaceAll(rendered, "", "ESC"),
strings.ReplaceAll(reset+reversed+"<"+reset+clearToEol, "", "ESC"))
}
func TestRenderLineLastReversedSpaces(t *testing.T) {
row := []Cell{
{
Rune: ' ',
Style: StyleDefault.WithAttr(AttrReverse),
},
}
rendered, count := renderLine(row)
assert.Equal(t, count, 1)
reset := ""
reversed := ""
clearToEol := ""
assert.Equal(t,
strings.ReplaceAll(rendered, "", "ESC"),
strings.ReplaceAll(reset+reversed+" "+reset+clearToEol, "", "ESC"))
}