;dev: cli: ledger tests: move test runner up, start collected tests

This commit is contained in:
Simon Michael 2022-12-18 00:11:04 -10:00
parent 370948a357
commit 1b56687708
2 changed files with 19 additions and 5 deletions

View File

@ -0,0 +1,11 @@
; In this journal, $'s precision is 2 in txn1, 4 in txn2, and 4 globally.
; Ledger checks transaction balancedness using local precisions only,
; so it accepts txn1's $-0.00045312 imbalance.
2022-01-01 txn1
expenses AAA 989.02 @ $1.123456 ; $1111.12045312
checking $-1111.12
2022-01-02 txn2
expenses $0.1234
checking

View File

@ -2,15 +2,18 @@
# Try to read all .test files, save and report the results.
set -e
for f in *.test; do
printf "%s: " "$f"
FILES=$(find . -name "*.j" -o -name "*.test")
#FILES=$(find . -name "*.j")
for f in $FILES ; do
printf ":%s: " "$f"
(hledger -f "$f" stats >/dev/null && echo ok) || echo fail
# (hledger -f "$f" stats >/dev/null 2>&1 && echo ok) || echo fail
# printf "." 1>&2
done 2>&1 | tee log
echo
cp log log."$(date +%Y%m%d)"
printf "files: "; rg -c '\.test:' log || echo 0
printf "read: "; rg -c ': ok$' log || echo 0
printf "failed: "; rg -c '(^|: )fail$' log || echo 0
printf "test files: %4d\n" "$(rg -c '^:' log || echo 0)"
printf "success: %4d\n" "$(rg -c ': ok$' log || echo 0)"
printf "failure: %4d\n" "$(rg -c '(^|: )fail$' log || echo 0)"
echo "tested on $(date +%Y-%m-%d) with $(hledger --version)"