OILS
/
stdlib
/
osh
/
two-test.sh
View on Github
|
oilshell.org
36 lines, 25 significant
1 | #!/usr/bin/env bash
|
2 |
|
3 | source stdlib/osh/two.sh
|
4 | source stdlib/osh/byo-server-lib.sh
|
5 |
|
6 | source test/common.sh # assert
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | test-log() {
|
13 | local stderr
|
14 | local status
|
15 |
|
16 | set +o errexit
|
17 | stderr=$(log hi 2>&1)
|
18 | status=$?
|
19 | set -o errexit
|
20 |
|
21 | assert 'hi' = "$stderr"
|
22 | assert 0 -eq "$status"
|
23 | }
|
24 |
|
25 | test-die() {
|
26 | local status
|
27 |
|
28 | set +o errexit
|
29 | ( die "bad" )
|
30 | status=$?
|
31 | set -o errexit
|
32 |
|
33 | assert 1 -eq "$status"
|
34 | }
|
35 |
|
36 | byo-maybe-main
|