-
Notifications
You must be signed in to change notification settings - Fork 37
/
apc_test.go
36 lines (29 loc) · 670 Bytes
/
apc_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
package terminal
import (
"testing"
"fyne.io/fyne/v2"
"github.com/stretchr/testify/assert"
)
func TestAPC(t *testing.T) {
var APCString string
RegisterAPCHandler("set apcstring:", func(terminal *Terminal, s string) {
APCString = s
})
testCases := map[string]struct {
input []byte
expected string
}{
"starts with APC command": {
input: append([]byte("\x1b_set apcstring:Hello"), 0),
expected: "Hello",
},
}
for name, testCase := range testCases {
t.Run(name, func(t *testing.T) {
term := New()
term.Resize(fyne.NewSize(50, 50))
term.handleOutput(testCase.input)
assert.Equal(t, testCase.expected, APCString)
})
}
}