1
1
mirror of https://github.com/walles/moar.git synced 2024-11-27 01:05:23 +03:00
moar/moar_test.go
Johan Walles b5d86961ed Fix a linter complaint
Why wasn't this seen until now?
2024-02-16 12:50:58 +01:00

34 lines
750 B
Go

package main
import (
"testing"
"github.com/walles/moar/twin"
"gotest.tools/v3/assert"
)
func TestParseScrollHint(t *testing.T) {
token, err := parseScrollHint("ESC[7m>")
assert.NilError(t, err)
assert.Equal(t, token, twin.Cell{
Rune: '>',
Style: twin.StyleDefault.WithAttr(twin.AttrReverse),
})
}
func TestPageOneInputFile(t *testing.T) {
pager, screen, _, formatter, err := pagerFromArgs(
[]string{"", "moar_test.go"},
func(_ twin.MouseMode, _ twin.ColorType) (twin.Screen, error) {
return twin.NewFakeScreen(80, 24), nil
},
false, // stdin is redirected
false, // stdout is redirected
)
assert.NilError(t, err)
assert.Assert(t, pager != nil)
assert.Assert(t, screen != nil)
assert.Assert(t, formatter != nil)
}