1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Run tests in this directory.
|
4 | #
|
5 | # Usage:
|
6 | # stdlib/TEST.sh <function name>
|
7 |
|
8 | : ${LIB_OSH=stdlib/osh}
|
9 | source $LIB_OSH/bash-strict.sh
|
10 |
|
11 | # TODO: byo-server.sh uses $BYO_COMMAND and $BYO_ARG
|
12 | # I guess we need a YSH version then? We could hack it with
|
13 | # $(sh -c 'echo $BYO_COMMAND')
|
14 |
|
15 | YSH='bin/ysh +o no_exported'
|
16 |
|
17 | test-byo-protocol() {
|
18 | return
|
19 |
|
20 | # Usually the "BYO" command does this
|
21 | BYO_COMMAND=detect $YSH stdlib/table.ysh
|
22 |
|
23 | # TODO: need assertions here
|
24 | # assert status
|
25 |
|
26 | # assert-ok 'echo hi'
|
27 | # assert-stdout 'echo hi'
|
28 | # assert-fail 2 '(exit 2)'
|
29 |
|
30 | # I think we usually don't need this
|
31 | # assert-fail-stdout 2 '(exit 2)'
|
32 |
|
33 | BYO_COMMAND=z $YSH stdlib/table.ysh
|
34 |
|
35 | # missing
|
36 | BYO_COMMAND=run-test $YSH stdlib/table.ysh
|
37 |
|
38 | # TODO: test file with no tests
|
39 | }
|
40 |
|
41 | soil-run() {
|
42 | test-byo-protocol
|
43 |
|
44 | devtools/byo.sh test $YSH stdlib/ysh/def-test.ysh
|
45 | #return
|
46 | devtools/byo.sh test $YSH stdlib/ysh/args-test.ysh
|
47 | devtools/byo.sh test $YSH stdlib/ysh/list-test.ysh
|
48 | devtools/byo.sh test $YSH stdlib/ysh/math-test.ysh
|
49 |
|
50 | devtools/byo.sh test $YSH stdlib/ysh/yblocks-test.ysh
|
51 | devtools/byo.sh test $YSH stdlib/ysh/stream.ysh
|
52 | devtools/byo.sh test $YSH stdlib/ysh/table.ysh
|
53 |
|
54 | # Run shebang, bash
|
55 | devtools/byo.sh test stdlib/osh/two-test.sh
|
56 | devtools/byo.sh test stdlib/osh/no-quotes-test.sh
|
57 | devtools/byo.sh test stdlib/osh/byo-server-test.sh
|
58 |
|
59 | # Run with osh
|
60 | devtools/byo.sh test bin/osh stdlib/osh/two-test.sh
|
61 |
|
62 | }
|
63 |
|
64 | "$@"
|