| 1 | #!/usr/bin/env bash
|
| 2 | #
|
| 3 | # Run tests in this directory.
|
| 4 | #
|
| 5 | # Usage:
|
| 6 | # stdlib/TEST.sh <function name>
|
| 7 |
|
| 8 | set -o nounset
|
| 9 | set -o pipefail
|
| 10 | set -o errexit
|
| 11 |
|
| 12 | YSH=bin/ysh
|
| 13 |
|
| 14 | test-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 |
|
| 38 | soil-run() {
|
| 39 | test-byo-protocol
|
| 40 |
|
| 41 | # Run this directly; don't create circular deps on BYO, etc.
|
| 42 | stdlib/osh/testing.sh test-capture-command
|
| 43 |
|
| 44 | test/byo-client.sh run-tests $YSH stdlib/stream.ysh
|
| 45 |
|
| 46 | test/byo-client.sh run-tests $YSH stdlib/table.ysh
|
| 47 |
|
| 48 | # Run shebang, bash
|
| 49 | test/byo-client.sh run-tests stdlib/osh/two-test.sh
|
| 50 |
|
| 51 | # Run with osh
|
| 52 | test/byo-client.sh run-tests bin/osh stdlib/osh/two-test.sh
|
| 53 | }
|
| 54 |
|
| 55 | "$@"
|