🏡 index : fennel-cljlib.git

author Andrey Orst <andreyorst@gmail.com> 2020-10-26 20:54:05.0 +03:00:00
committer Andrey Orst <andreyorst@gmail.com> 2020-10-26 20:54:05.0 +03:00:00
commit
d4da5f6c16f9fbbedb4f6b1fdcc0d617b3241219 [patch]
tree
7de59fa040fa0835b233c8f6110d0a76246fdd67
parent
f696a71b13d6867bf7168e6314eeaa8663b30e92
download
d4da5f6c16f9fbbedb4f6b1fdcc0d617b3241219.tar.gz

feature: add simple script to check approx test coverage



Diff

 coverage.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/coverage.sh b/coverage.sh
new file mode 100755
index 0000000..f5b0371 100755
--- /dev/null
+++ a/coverage.sh
@@ -1,0 +1,14 @@
#!/bin/env sh

fns=$(grep "^(fn" core.fnl macros/core.fnl | cut -f2 --delimiter=" " | grep -v "^-")
tsts=$(for fn in $fns; do fn=$(echo "$fn" | sed "s/\?/\\\?/"); grep "(test $fn" core_test.fnl macros_test.fnl | cut -f2 --delimiter=" "; done)
not_tested=$(printf "%s\n%s" "$fns" "$tsts" | sort | uniq -u)

total_fns=$(echo "$fns" | wc -l)
total_not_tested=$(echo "$not_tested" | wc -l)
coverage=$((100 - (("$total_not_tested" * 100) / "$total_fns")))

echo "coverage: $coverage%" >&2
echo "not tested functions:" >&2
echo "$not_tested" | tr '\n' ' ' >&2
echo >&2