forked from zyedidia/terminal
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathcsi_test.go
More file actions
36 lines (31 loc) · 752 Bytes
/
csi_test.go
File metadata and controls
36 lines (31 loc) · 752 Bytes
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
package vt10x
import (
"testing"
)
func TestCSIParse(t *testing.T) {
var csi csiEscape
csi.reset()
csi.buf = []byte("s")
csi.parse()
if csi.mode != 's' || csi.arg(0, 17) != 17 || len(csi.args) != 0 {
t.Fatal("CSI parse mismatch")
}
csi.reset()
csi.buf = []byte("31T")
csi.parse()
if csi.mode != 'T' || csi.arg(0, 0) != 31 || len(csi.args) != 1 {
t.Fatal("CSI parse mismatch")
}
csi.reset()
csi.buf = []byte("48;2f")
csi.parse()
if csi.mode != 'f' || csi.arg(0, 0) != 48 || csi.arg(1, 0) != 2 || len(csi.args) != 2 {
t.Fatal("CSI parse mismatch")
}
csi.reset()
csi.buf = []byte("?25l")
csi.parse()
if csi.mode != 'l' || csi.arg(0, 0) != 25 || csi.priv != true || len(csi.args) != 1 {
t.Fatal("CSI parse mismatch")
}
}