commit 0f895f6f0c69c97dec88c26725515c00e014ba07
parent 6ab0661e99e911b43201454b82c03630b5d3fc5f
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 19 Dec 2017 15:12:26 -0800
test: fail var won't work in subshells
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/run b/test/run
@@ -1,12 +1,14 @@
 #!/usr/bin/env bash
 
+set -e
+
 n=1
 c=$(($(wc -l < tests.csv) - 1))
-fail=0
 
 printf "1..%d\n" "$c"
 
 tail -n+2 tests.csv | \
+(fail=0
 while IFS=, read -r description args input expected
 do
     output=$(../bcalc $args <<<"$input" 2>&1)
@@ -19,5 +21,6 @@ do
     fi
     n=$((n + 1))
 done
+ exit $fail
+)
 
-exit $fail