This repository has been archived by the owner on Feb 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.bats
executable file
·68 lines (55 loc) · 1.57 KB
/
test.bats
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
#!/usr/bin/env bats
@test 'env: jq, curl, sed' {
run eval which\ {curl,jq,sed}\;
[ "$status" = 0 ]
}
@test 'test0: help' {
o="$(./websh |& wc -l)"
[ "$o" -eq 19 ]
}
@test 'test1: arg, stdout' {
o="$(./websh "echo test1" | wc -l)"
[ "$o" -eq 12 ]
}
@test 'test2: arg, stdout, stderr' {
o="$(./websh "echo test2;echo hello>&2" | wc -l)"
[ "$o" -eq 13 ]
}
@test 'test3: arg, stdout, stderr, images' {
o="$(./websh "echo test3;echo hello>&2;echo a|textimg -s" | wc -l)"
[ "$o" -eq 13 ]
}
@test 'test4: stdin, stdout' {
o="$(echo "echo test4" | ./websh | wc -l)"
[ "$o" -eq 12 ]
}
@test 'test5: stdin, stdout, stderr' {
o="$(echo "echo test5;echo hello>&2" | ./websh | wc -l)"
[ "$o" -eq 13 ]
}
@test 'test6: stdin, stdout, stderr, images' {
o="$(echo "echo test6;echo hello>&2;echo a|textimg -s" | ./websh | wc -l)"
[ "$o" -eq 13 ]
}
@test 'test7: arg, stdout, input images' {
o="$(./websh -i demo1.png -i demo2.png 'ls media' | wc -l)"
[ "$o" -eq 13 ]
}
@test 'test8: arg, stdout, stderr, input images' {
o="$(./websh -i demo1.png -i demo2.png 'ls media;echo test >&2' | wc -l)"
[ "$o" -eq 14 ]
}
@test 'test9: arg, stdout, stderr, images, input images' {
o="$(./websh -i demo1.png -i demo2.png 'ls media;echo test >&2;mv media/* images' | wc -l)"
[ "$o" -eq 17 ]
}
@test 'test10: arg, stdout, stderr, images, input images' {
mkdir -p a
o="$(./websh -i demo1.png -i demo2.png -d a 'ls media;echo test >&2;mv media/* images'| wc -l)"
[ "$o" -eq 17 ]
}
@test 'test11: arg, plain' {
mkdir -p a
o="$(./websh -p 'echo test' | wc -l)"
[ "$o" -eq 1 ]
}