OILS / stdlib / osh / two-test.sh View on Github | oilshell.org

35 lines, 22 significant
1#!/usr/bin/env bash
2
3source stdlib/osh/two.sh # module under test
4
5source stdlib/osh/byo-server-lib.sh
6source stdlib/osh/testing.sh
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12test-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
22test-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
35byo-must-run