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.sh
6source stdlib/osh/no-quotes.sh
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12test-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
22test-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
35byo-must-run