mirror of
https://github.com/walles/moar.git
synced 2024-11-30 02:34:13 +03:00
b5d86961ed
Why wasn't this seen until now?
34 lines
750 B
Go
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)
|
|
}
|