aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-24 23:53:28 +0900
committernsfisis <nsfisis@gmail.com>2025-08-24 23:55:28 +0900
commit5bbc4414b8178ff924444857ac05e5b06cf0e651 (patch)
treecfd46a260389dfeb8a60760d5d7074dc98d3bc7e /tests
parentf30ceaaf80a54069bde3563646b7abb3e4ef03ae (diff)
downloadducc-5bbc4414b8178ff924444857ac05e5b06cf0e651.tar.gz
ducc-5bbc4414b8178ff924444857ac05e5b06cf0e651.tar.zst
ducc-5bbc4414b8178ff924444857ac05e5b06cf0e651.zip
fix: test runner
Diffstat (limited to 'tests')
-rw-r--r--tests/test_helpers.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/test_helpers.sh b/tests/test_helpers.sh
index 349dc3a..eaccd5c 100644
--- a/tests/test_helpers.sh
+++ b/tests/test_helpers.sh
@@ -1,19 +1,18 @@
function test_exit_code() {
- set +e
cat > main.c
"$ducc" -o a.out main.c
+ set +e
./a.out
exit_code=$?
+ set -e
expected=$1
if [[ $exit_code -ne $expected ]]; then
echo "invalid exit code: expected $expected, but got $exit_code" >&2
- set -e
exit 1
fi
- set -e
}
function test_diff() {
@@ -35,18 +34,19 @@ function test_diff() {
}
function test_compile_error() {
- set +e
cat > main.c
+ set +e
"$ducc" main.c > /dev/null 2> output
- if [[ $? -eq 0 ]]; then
- "expected to fail"
- set -e
+ exit_code=$?
+ set -e
+
+ if [[ $exit_code -eq 0 ]]; then
+ echo "expected to fail" >&2
exit 1
fi
diff -u expected output
- set -e
}
function test_example() {