aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/007.sh9
-rw-r--r--tests/008.sh11
-rw-r--r--tests/test_exit_code.sh2
3 files changed, 21 insertions, 1 deletions
diff --git a/tests/007.sh b/tests/007.sh
new file mode 100644
index 0000000..6f043b7
--- /dev/null
+++ b/tests/007.sh
@@ -0,0 +1,9 @@
+set -e
+
+bash ../../test_exit_code.sh 42 <<'EOF'
+int main() {
+ int foo;
+ foo = 42;
+ return foo;
+}
+EOF
diff --git a/tests/008.sh b/tests/008.sh
new file mode 100644
index 0000000..94936cd
--- /dev/null
+++ b/tests/008.sh
@@ -0,0 +1,11 @@
+set -e
+
+bash ../../test_exit_code.sh 70 <<'EOF'
+int main() {
+ int foo;
+ int bar;
+ foo = 42;
+ bar = 28;
+ return foo + bar;
+}
+EOF
diff --git a/tests/test_exit_code.sh b/tests/test_exit_code.sh
index f69e862..ad548e4 100644
--- a/tests/test_exit_code.sh
+++ b/tests/test_exit_code.sh
@@ -12,6 +12,6 @@ exit_code=$?
expected=$1
if [[ ! $exit_code -eq $expected ]]; then
- echo "expected $expected, but $exit_code" >&2
+ echo "invalid exit code: expected $expected, but got $exit_code" >&2
exit 1
fi