summaryrefslogtreecommitdiff
path: root/coverage.sh
diff options
context:
space:
mode:
Diffstat (limited to 'coverage.sh')
-rwxr-xr-xcoverage.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/coverage.sh b/coverage.sh
index 23c5c31..c66d2af 100755
--- a/coverage.sh
+++ b/coverage.sh
@@ -7,10 +7,20 @@ tsts=$(
grep -o "(testing $fn[^ ]*" core_test.fnl macros_test.fnl | cut -f2 --delimiter=" "
done
)
-not_tested=$(printf "%s\n%s" "$fns" "$tsts" | sort | uniq -u)
+not_tested=$(printf "%s\n%s\n" "$fns" "$tsts" | sort | uniq -u)
+
+if [ -z "$fns" ]; then
+ total_fns=0
+else
+ total_fns=$(printf "%s\n" "$fns" | wc -l)
+fi
+
+if [ -z "$not_tested" ]; then
+ total_not_tested=0
+else
+ total_not_tested=$(printf "%s\n" "$not_tested" | wc -l)
+fi
-total_fns=$(printf "%s" "$fns" | wc -l)
-total_not_tested=$(printf "%s" "$not_tested" | wc -l)
coverage=$((100 - (("$total_not_tested" * 100) / "$total_fns")))
echo "test coverage: $coverage%" >&2