-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvim_delete_test.go
62 lines (57 loc) · 1 KB
/
vim_delete_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package readline
import (
"testing"
)
// TestViDeleteByAdjustLogicNoPanic just tests that viDeleteByAdjust() doesn't cause
// a panic:
// https://github.com/lmorg/murex/issues/341
type TestViDeleteByAdjustT struct {
Line string
Pos int
Adjust int
}
func TestViDeleteByAdjustLogicNoPanic(t *testing.T) {
tests := []TestViDeleteByAdjustT{
{
Line: "The quick brown fox",
Pos: 0,
Adjust: -1,
},
{
Line: "The quick brown fox",
Pos: 1,
Adjust: -1,
},
{
Line: "The quick brown fox",
Pos: 1,
Adjust: -2,
},
{
Line: "The quick brown fox",
Pos: 2,
Adjust: -2,
},
{
Line: "The quick brown fox",
Pos: 5,
Adjust: -1,
},
{
Line: "The quick brown fox",
Pos: 5,
Adjust: 1,
},
{
Line: "The quick brown fox",
Pos: 5,
Adjust: 100,
},
}
for _, test := range tests {
rl := NewInstance()
rl.line.Set(rl, []rune(test.Line))
rl.line.SetRunePos(test.Pos)
rl.viDeleteByAdjustLogic(&test.Adjust)
}
}