summaryrefslogtreecommitdiff
path: root/ui/editor_test.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-05-25 18:37:11 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-05-25 18:37:11 +0200
commit5cb1bbea9f3b94c23684ce8660d164f5bd13de98 (patch)
tree57383ac49aa8178489d7db36358e5bb8b0dd0229 /ui/editor_test.go
parentcommands: use rawArgs on non-command (diff)
Fix ui tests
Diffstat (limited to 'ui/editor_test.go')
-rw-r--r--ui/editor_test.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/ui/editor_test.go b/ui/editor_test.go
index 9f4e131..ea2b165 100644
--- a/ui/editor_test.go
+++ b/ui/editor_test.go
@@ -2,21 +2,21 @@ package ui
import "testing"
-var hell editor = editor{
- text: []rune{'h', 'e', 'l', 'l'},
+var hell Editor = Editor{
+ text: [][]rune{[]rune{'h', 'e', 'l', 'l'}},
textWidth: []int{0, 1, 2, 3, 4},
cursorIdx: 4,
offsetIdx: 0,
width: 5,
}
-func assertEditorEq(t *testing.T, actual, expected editor) {
+func assertEditorEq(t *testing.T, actual, expected Editor) {
if len(actual.text) != len(expected.text) {
t.Errorf("expected text len to be %d, got %d\n", len(expected.text), len(actual.text))
} else {
for i := 0; i < len(actual.text); i++ {
- a := actual.text[i]
- e := expected.text[i]
+ a := actual.text[0][i]
+ e := expected.text[0][i]
if a != e {
t.Errorf("expected rune #%d to be '%c', got '%c'\n", i, e, a)
@@ -51,10 +51,10 @@ func assertEditorEq(t *testing.T, actual, expected editor) {
}
func TestOneLetter(t *testing.T) {
- e := newEditor(5)
+ e := NewEditor(5, nil)
e.PutRune('h')
- assertEditorEq(t, e, editor{
- text: []rune{'h'},
+ assertEditorEq(t, e, Editor{
+ text: [][]rune{[]rune{'h'}},
textWidth: []int{0, 1},
cursorIdx: 1,
offsetIdx: 0,
@@ -63,7 +63,7 @@ func TestOneLetter(t *testing.T) {
}
func TestFourLetters(t *testing.T) {
- e := newEditor(5)
+ e := NewEditor(5, nil)
e.PutRune('h')
e.PutRune('e')
e.PutRune('l')
@@ -72,7 +72,7 @@ func TestFourLetters(t *testing.T) {
}
func TestOneLeft(t *testing.T) {
- e := newEditor(5)
+ e := NewEditor(5, nil)
e.PutRune('h')
e.PutRune('l')
e.Left()
@@ -83,7 +83,7 @@ func TestOneLeft(t *testing.T) {
}
func TestOneRem(t *testing.T) {
- e := newEditor(5)
+ e := NewEditor(5, nil)
e.PutRune('h')
e.PutRune('l')
e.RemRune()
@@ -94,7 +94,7 @@ func TestOneRem(t *testing.T) {
}
func TestLeftAndRem(t *testing.T) {
- e := newEditor(5)
+ e := NewEditor(5, nil)
e.PutRune('h')
e.PutRune('l')
e.PutRune('e')