OILS / stdlib / TEST.sh View on Github | oilshell.org

53 lines, 15 significant
1#!/usr/bin/env bash
2#
3# Run tests in this directory.
4#
5# Usage:
6# stdlib/TEST.sh <function name>
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12YSH=bin/ysh
13
14test-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
38soil-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"$@"