1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Run tests in this directory.
|
4 | #
|
5 | # Usage:
|
6 | # stdlib/TEST.sh <function name>
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | YSH=bin/ysh
|
13 |
|
14 | test-byo-protocol() {
|
15 | return
|
16 |
|
17 | # Usually the "BYO" command does this
|
18 | BYO_COMMAND=detect $YSH stdlib/table.ysh
|
19 |
|
20 | # TODO: need assertions here
|
21 | # assert status
|
22 |
|
23 | # assert-ok 'echo hi'
|
24 | # assert-stdout 'echo hi'
|
25 | # assert-fail 2 '(exit 2)'
|
26 |
|
27 | # I think we usually don't need this
|
28 | # assert-fail-stdout 2 '(exit 2)'
|
29 |
|
30 | BYO_COMMAND=z $YSH stdlib/table.ysh
|
31 |
|
32 | # missing
|
33 | BYO_COMMAND=run-test $YSH stdlib/table.ysh
|
34 |
|
35 | # TODO: test file with no tests
|
36 | }
|
37 |
|
38 | soil-run() {
|
39 | test-byo-protocol
|
40 |
|
41 | test/byo-client.sh run-tests $YSH stdlib/stream.ysh
|
42 |
|
43 | test/byo-client.sh run-tests $YSH stdlib/table.ysh
|
44 |
|
45 | # I guess this needs tests, with an assertion library for stdout?
|
46 |
|
47 | # TODO: if there are no tests, it should fail
|
48 | # test/byo-client.sh run-tests $SH stdlib/two.sh
|
49 | }
|
50 |
|
51 |
|
52 |
|
53 | "$@"
|