forked from Distributive-Network/PythonMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer-throw.bash
More file actions
executable file
·38 lines (33 loc) · 874 Bytes
/
timer-throw.bash
File metadata and controls
executable file
·38 lines (33 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/bash
#
# @file program-throw.bash
# A peter-jr test which shows that uncaught exceptions in the program throw, get shown
# on stderr, cause a non-zero exit code, and aren't delayed because of pending events.
#
# @author Wes Garland, wes@distributive.network
# @date July 2023
#
# timeout: 5
set -u
panic()
{
echo "FAIL: $*" >&2
exit 2
}
cd `dirname "$0"` || panic "could not change to test directory"
"${PMJS:-../../pmjs}" ./timer-throw.js 2>&1 1>/dev/null \
| egrep 'hello|goodbye' \
| (
read line
if [[ "$line" =~ hello ]]; then
echo "found expected '$line'"
else
panic "expected hello, found '${line}'"
fi
read line
if [[ "$line" =~ Error:.goodbye ]]; then
echo "found expected '$line'"
else
panic "expected Error: goodbye, found '${line}'"
fi
)