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

57 lines, 16 significant
1#!/usr/bin/env bash
2#
3# Run tests in this directory.
4#
5# Usage:
6# stdlib/TEST.sh <function name>
7
8# TODO:
9# : ${LIB_OSH=stlib/osh}
10# source $LIB_OSH/bash-strict.sh
11
12source stdlib/osh/bash-strict.sh
13
14YSH=bin/ysh
15
16test-byo-protocol() {
17 return
18
19 # Usually the "BYO" command does this
20 BYO_COMMAND=detect $YSH stdlib/table.ysh
21
22 # TODO: need assertions here
23 # assert status
24
25 # assert-ok 'echo hi'
26 # assert-stdout 'echo hi'
27 # assert-fail 2 '(exit 2)'
28
29 # I think we usually don't need this
30 # assert-fail-stdout 2 '(exit 2)'
31
32 BYO_COMMAND=z $YSH stdlib/table.ysh
33
34 # missing
35 BYO_COMMAND=run-test $YSH stdlib/table.ysh
36
37 # TODO: test file with no tests
38}
39
40soil-run() {
41 test-byo-protocol
42
43 # Run this directly; don't create circular deps on BYO, etc.
44 stdlib/osh/no-quotes.sh test-nq-capture
45
46 test/byo-client.sh run-tests $YSH stdlib/stream.ysh
47
48 test/byo-client.sh run-tests $YSH stdlib/table.ysh
49
50 # Run shebang, bash
51 test/byo-client.sh run-tests stdlib/osh/two-test.sh
52
53 # Run with osh
54 test/byo-client.sh run-tests bin/osh stdlib/osh/two-test.sh
55}
56
57"$@"