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