From 2fc74b6eab0761a4d76c3346ca02df8a60058128 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 31 Jul 2022 07:17:16 +0100 Subject: [PATCH] dev: add recentassertions test, update assertions test --- hledger/test/errors/README.md | 29 +++++++++++++++++++---- hledger/test/errors/assertions.test | 3 ++- hledger/test/errors/recentassertions.j | 7 ++++++ hledger/test/errors/recentassertions.test | 11 +++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100755 hledger/test/errors/recentassertions.j create mode 100644 hledger/test/errors/recentassertions.test diff --git a/hledger/test/errors/README.md b/hledger/test/errors/README.md index e88bd5217..6a7df8346 100644 --- a/hledger/test/errors/README.md +++ b/hledger/test/errors/README.md @@ -131,6 +131,7 @@ Click error names to see an example. The table headings mean: | [parseable-dates](#parseable-dates) | ✓ | ✓ | ✓ | ✓✓ | ✓ | | [parseable-regexps](#parseable-regexps) | ✓ | ✓ | ✓ | ✓✓ | ✓ | | [payees](#payees) | ✓ | ✓ | ✓ | ✓✓ | ✓ | +| [recentassertions](#recentassertions) | ✓ | ✓ | ✓ | ✓✓ | ✓ | | [uniqueleafnames](#uniqueleafnames) | ✓ | ✓ | ✓ | ✓✓ | ✓ | | [tcclockouttime](#tcclockouttime) | ✓ | ✓ | ✓ | ✓✓ | | | [tcorderedactions](#tcorderedactions) | ✓ | ✓ | ✓ | ✓✓ | | @@ -155,7 +156,7 @@ Click error names to see an example. The table headings mean: -hledger 1.26.99-ga7b920750-20220715 error messages: +hledger 1.26.99-g99825d37f-20220731 error messages: ### accounts ``` @@ -183,9 +184,9 @@ hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./assertions.j:4:8: This balance assertion failed. In account: a and commodity: -this balance was asserted: 1 -but the actual balance is: 0 -a difference of: 1 +this balance was asserted: 1 +but the calculated balance is: 0 +a difference of: 1 Consider viewing this account's register to troubleshoot. Eg: @@ -301,6 +302,26 @@ payee p ``` +### recentassertions +``` +hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./recentassertions.j:4:8: + | 2022-01-01 * +4 | a 0 = 0 + | ^^^ + +The recentassertions check is enabled, so accounts with balance assertions +must have an assertion no more than 7 days before their latest posting date. +In account a, +the last balance assertion (2022-01-01) was 8 days before +the latest posting (2022-01-09). + +Consider adding a more recent balance assertion for this account. Eg: + +2022-07-31 * + a $0 = $0 ; <- adjust +``` + + ### uniqueleafnames ``` hledger: Error: /Users/simon/src/hledger/hledger/test/errors/./uniqueleafnames.j:12: diff --git a/hledger/test/errors/assertions.test b/hledger/test/errors/assertions.test index 667923711..b98f53ab1 100644 --- a/hledger/test/errors/assertions.test +++ b/hledger/test/errors/assertions.test @@ -10,5 +10,6 @@ and commodity: this balance was asserted: 1 but the calculated balance is: 0 a difference of: 1 -/ + +Consider viewing t/ >>>= 1 diff --git a/hledger/test/errors/recentassertions.j b/hledger/test/errors/recentassertions.j new file mode 100755 index 000000000..431979633 --- /dev/null +++ b/hledger/test/errors/recentassertions.j @@ -0,0 +1,7 @@ +#!/usr/bin/env -S hledger check recentassertions -f + +2022-01-01 * + a 0 = 0 + +2022-01-09 * + a 0 diff --git a/hledger/test/errors/recentassertions.test b/hledger/test/errors/recentassertions.test new file mode 100644 index 000000000..90debbfc3 --- /dev/null +++ b/hledger/test/errors/recentassertions.test @@ -0,0 +1,11 @@ +$$$ hledger check recentassertions -f recentassertions.j +>>>2 /hledger: Error: .*recentassertions.j:4:8: + \| 2022-01-01 \* +4 \| a 0 = 0 + \| \^\^\^ + +The recentassertions check is enabled, so accounts with balance assertions +must have an assertion no more than 7 days before their latest posting date. +In account a, +the las/ +>>>= 1