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