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

55 lines, 18 significant
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}
9source $LIB_OSH/bash-strict.sh
10
11YSH=bin/ysh
12
13test-byo-protocol() {
14 return
15
16 # Usually the "BYO" command does this
17 BYO_COMMAND=detect $YSH stdlib/table.ysh
18
19 # TODO: need assertions here
20 # assert status
21
22 # assert-ok 'echo hi'
23 # assert-stdout 'echo hi'
24 # assert-fail 2 '(exit 2)'
25
26 # I think we usually don't need this
27 # assert-fail-stdout 2 '(exit 2)'
28
29 BYO_COMMAND=z $YSH stdlib/table.ysh
30
31 # missing
32 BYO_COMMAND=run-test $YSH stdlib/table.ysh
33
34 # TODO: test file with no tests
35}
36
37soil-run() {
38 test-byo-protocol
39
40 devtools/byo.sh run-tests $YSH stdlib/stream.ysh
41
42 devtools/byo.sh run-tests $YSH stdlib/table.ysh
43
44 # Run shebang, bash
45 devtools/byo.sh run-tests stdlib/osh/two-test.sh
46
47 devtools/byo.sh run-tests stdlib/osh/no-quotes-test.sh
48
49 # Run with osh
50 devtools/byo.sh run-tests bin/osh stdlib/osh/two-test.sh
51
52 devtools/byo.sh run-tests bin/ysh stdlib/ysh/yblocks-test.ysh
53}
54
55"$@"