-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathosCLI_test.go
68 lines (56 loc) · 1.09 KB
/
osCLI_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
63
64
65
66
67
68
package main
import (
"os"
"strings"
"testing"
)
func Test_OSCLI_HELP(t *testing.T) {
out := integrationTestBasic([]string{
"*HELP",
})
if !strings.Contains(out, "BBZ") {
t.Log(out)
t.Error("*HELP is not returning BBZ")
}
}
func Test_OSCLI_FX_commas(t *testing.T) {
out := integrationTestBasic([]string{
"*FX 200,3",
"IF ERR=40 PRINT \"PA\" + \"SS\"",
})
if !strings.Contains(out, "PASS") {
t.Log(out)
t.Error("*FX error")
}
}
func Test_OSCLI_FX_spaces(t *testing.T) {
out := integrationTestBasic([]string{
"*FX200 3 1",
"IF ERR=40 PRINT \"PA\" + \"SS\"",
})
if !strings.Contains(out, "PASS") {
t.Log(out)
t.Error("*FX error")
}
}
func Test_OSCLI_TYPE(t *testing.T) {
source := "Hi []{}"
printed := "Hi ←→¼¾>"
// Prepare a file
file, err := os.CreateTemp("", "bbztest.*.txt")
if err != nil {
t.Fatal(err)
}
defer os.Remove(file.Name())
_, err = file.WriteString(source)
if err != nil {
t.Fatal(err)
}
out := integrationTestBasic([]string{
"*TYPE " + file.Name(),
})
if !strings.Contains(out, printed) {
t.Log(out)
t.Error("*TYPE error")
}
}