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