| 1 | #!/usr/bin/env bash
|
| 2 |
|
| 3 | : ${LIB_OSH=stdlib/osh}
|
| 4 |
|
| 5 | source $LIB_OSH/two.sh # module under test
|
| 6 | source $LIB_OSH/bash-strict.sh
|
| 7 | source $LIB_OSH/no-quotes.sh
|
| 8 | source $LIB_OSH/task-five.sh
|
| 9 |
|
| 10 | test-log() {
|
| 11 | local status stderr
|
| 12 |
|
| 13 | nq-capture-2 status stderr \
|
| 14 | log hi
|
| 15 |
|
| 16 | nq-assert 'hi' = "$stderr"
|
| 17 | nq-assert 0 = "$status"
|
| 18 | }
|
| 19 |
|
| 20 | test-die() {
|
| 21 | local status
|
| 22 |
|
| 23 | # This calls exit, so we don't use nq-capture
|
| 24 |
|
| 25 | set +o errexit
|
| 26 | ( die "bad" )
|
| 27 | status=$?
|
| 28 | set -o errexit
|
| 29 |
|
| 30 | nq-assert 1 -eq "$status"
|
| 31 | }
|
| 32 |
|
| 33 | task-five "$@"
|