aboutsummaryrefslogtreecommitdiff
path: root/tests/common.sh
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-01-29 13:52:58 -0500
committerMustafa Quraish <[email protected]>2022-01-29 13:53:57 -0500
commite403475bbf6f70b3e79b6f4503dbadcc3dad504c (patch)
tree40c77638cf96048328358e601c541ab31fb2b23a /tests/common.sh
parentAdd some tests for local variables (diff)
downloadcup-e403475bbf6f70b3e79b6f4503dbadcc3dad504c.tar.xz
cup-e403475bbf6f70b3e79b6f4503dbadcc3dad504c.zip
Allow uninitialized variable declarations
Diffstat (limited to 'tests/common.sh')
-rw-r--r--tests/common.sh23
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/common.sh b/tests/common.sh
index 7c8b5ae..dd64ade 100644
--- a/tests/common.sh
+++ b/tests/common.sh
@@ -18,8 +18,8 @@ function assert_exit_status() {
echo ""
echo "----------------------------------"
echo "Test failed: expected $2, got $res"
- echo "- Input was:"
- echo " \`$1\`"
+ echo "----------------------------------"
+ echo "$1"
exit 1
fi
set -e
@@ -27,21 +27,6 @@ function assert_exit_status() {
}
function assert_exit_status_stdin() {
- ./cupcc -
- assemble
-
- set +e
- ./a.out
- res=$?
- if [ $res -ne $1 ]
- then
- echo ""
- echo "----------------------------------"
- echo "Test failed: expected $2, got $res"
- echo "- Input was:"
- echo " \`$1\`"
- exit 1
- fi
- set -e
- echo -n "."
+ code=$(</dev/stdin)
+ assert_exit_status "$code" $1
} \ No newline at end of file