File: test-eval-error-nested.t

package info (click to toggle)
esh 0.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 316 kB
  • sloc: sh: 431; makefile: 55
file content (22 lines) | stat: -rwxr-xr-x 438 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# vim: set ts=4:
set -u

export TEST_NAME='test-eval-error-nested'

cd "$(dirname "$0")"

# Generate expectation file based on the used shell.
cmd() {
	${ESH_SHELL:-sh} -c 'set -eu; does-not-exist-666'
}
msg=$(cmd 2>&1 | rev | cut -d: -f1-2 | rev)
cmd >/dev/null 2>&1 || status=$?

cat > $TEST_NAME.exp2 <<EOF
incl/eval-error.esh:3: ${msg# *}
%exit-status: $status
EOF
trap "rm '$TEST_NAME.exp2'" EXIT HUP INT TERM

./diff-test