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

60 lines, 23 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 test $YSH stdlib/ysh/def-test.ysh
41 #return
42 devtools/byo.sh test $YSH stdlib/ysh/args-test.ysh
43 devtools/byo.sh test $YSH stdlib/ysh/list-test.ysh
44 devtools/byo.sh test $YSH stdlib/ysh/math-test.ysh
45
46 devtools/byo.sh test $YSH stdlib/ysh/yblocks-test.ysh
47 devtools/byo.sh test $YSH stdlib/ysh/stream.ysh
48 devtools/byo.sh test $YSH stdlib/ysh/table.ysh
49
50 # Run shebang, bash
51 devtools/byo.sh test stdlib/osh/two-test.sh
52 devtools/byo.sh test stdlib/osh/no-quotes-test.sh
53 devtools/byo.sh test stdlib/osh/byo-server-test.sh
54
55 # Run with osh
56 devtools/byo.sh test bin/osh stdlib/osh/two-test.sh
57
58}
59
60"$@"