From 6d0161d74260461996a6c73c2f591fe2419abd88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Sch=C3=B6ttl?= Date: Fri, 19 Apr 2019 18:12:29 +0200 Subject: [PATCH] Add CLI tests for report interval --- tests/cli/report-interval.test | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/cli/report-interval.test diff --git a/tests/cli/report-interval.test b/tests/cli/report-interval.test new file mode 100644 index 000000000..a7fd0112d --- /dev/null +++ b/tests/cli/report-interval.test @@ -0,0 +1,53 @@ + +# Input for the following tests: + +2019-01-01 + (a) 2 + +2019-02-01 + (a) 1 + + + + +# The last report interval option takes precedence. + +$ hledger -f- register --weekly --monthly +2019/01 a 2 2 +2019/02 a 1 3 + +$ hledger -f- register --monthly --weekly +2018/12/31w01 a 2 2 +2019/01/28w05 a 1 3 + +# The last report interval option takes precedence. +# The --period expression is no exception. +$ hledger -f- register -p 'monthly in 2019' --weekly +2018/12/31w01 a 2 2 +2019/01/28w05 a 1 3 + +$ hledger -f- register --weekly -p 'monthly in 2019' +2019/01 a 2 2 +2019/02 a 1 3 + + + +# The next three tests test the bugfix for issue #1008: +# The report interval from an --period expression only counts if it is +# explicitly specified (e.g. -p 'monthly in ...'). +# Thus, the following three options are equivalent: +# --monthly -p2019 +# -p2019 --monthly +# -p 'monthly in 2019' + +$ hledger -f- register --monthly -p 2019 +2019/01 a 2 2 +2019/02 a 1 3 + +$ hledger -f- register -p 2019 --monthly +2019/01 a 2 2 +2019/02 a 1 3 + +$ hledger -f- register -p 'monthly in 2019' +2019/01 a 2 2 +2019/02 a 1 3