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