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

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