aboutsummaryrefslogtreecommitdiff
path: root/tests/common.sh
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-01-29 12:31:14 -0500
committerMustafa Quraish <[email protected]>2022-01-29 12:31:14 -0500
commit0ff4735622a22b0630669307a78bced7c20d5bdc (patch)
tree9ab76b0efe6c90b722b1bfc5aed03b410f9b5e63 /tests/common.sh
parentNow supporting local variables! :^) (diff)
downloadcup-0ff4735622a22b0630669307a78bced7c20d5bdc.tar.xz
cup-0ff4735622a22b0630669307a78bced7c20d5bdc.zip
Add some tests for local variables
Diffstat (limited to 'tests/common.sh')
-rw-r--r--tests/common.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/common.sh b/tests/common.sh
index 4469874..7c8b5ae 100644
--- a/tests/common.sh
+++ b/tests/common.sh
@@ -24,4 +24,24 @@ function assert_exit_status() {
fi
set -e
echo -n "."
+}
+
+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 "."
} \ No newline at end of file