;dev: clean up dates, intervals func tests
This commit is contained in:
parent
4b3abfd470
commit
a1c6a409bc
@ -1,4 +1,4 @@
|
||||
# * multi-column balance reports
|
||||
# * balance reports with report intervals
|
||||
|
||||
# ** 1. Here are the postings used in most tests below:
|
||||
$ hledger -f balance-multicol.journal register
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
# * date options and arguments
|
||||
|
||||
# Input for the following tests:
|
||||
|
||||
@ -7,48 +8,44 @@
|
||||
2019-02-01
|
||||
(a) 1
|
||||
|
||||
|
||||
|
||||
# Test the date output format.
|
||||
# ** 0. Test the date output format.
|
||||
# If this one fails, we got a wrong regex and the inverted regex tests below
|
||||
# are also wrong.
|
||||
$ hledger -f- register
|
||||
> /2019-01-01/
|
||||
|
||||
# Show only February
|
||||
# ** 0. Show only February
|
||||
$ hledger -f- register -p 2019-02
|
||||
> !/2019-01-01/
|
||||
|
||||
# The last -b overrides the first -b
|
||||
# ** 0. The last -b overrides the first -b
|
||||
# -> show only February
|
||||
$ hledger -f- register -b 2019 -b 2019-02
|
||||
> !/2019-01-01/
|
||||
|
||||
# The last -e overrides the first -e
|
||||
# ** 0. The last -e overrides the first -e
|
||||
# Note that -e means: include posting/txns BEFORE this date.
|
||||
# -> show only January
|
||||
$ hledger -f- register -e 2020 -e 2019-02-01
|
||||
> !/2019-02-01/
|
||||
|
||||
# -p's begin overrides -b because it comes last
|
||||
# ** 0. -p's begin overrides -b because it comes last
|
||||
# -> show only February
|
||||
$ hledger -f- register -b 2019-01-01 -p 2019-02
|
||||
> !/2019-01-01/
|
||||
|
||||
# -e overrides -p's end because it come last
|
||||
# ** 0. -e overrides -p's end because it comes last
|
||||
# -> show only first part of January
|
||||
$ hledger -f- register -p 2019 -e 2019-01-20
|
||||
> !/2019-02-01/
|
||||
|
||||
# Date options and queries are AND'ed and produce the intersection independent
|
||||
# of their order
|
||||
# ** 0. Date options and queries are AND'ed and produce the intersection independent of their order
|
||||
$ hledger -f- register date:2019-02 -p 2019
|
||||
> !/2019-01-01/
|
||||
$ hledger -f- register -p 2019 date:2019-02
|
||||
> !/2019-01-01/
|
||||
|
||||
# Date queries are AND'ed and produce the intersection independent of their
|
||||
# order
|
||||
# ** 0. Date queries are AND'ed and produce the intersection independent of their order
|
||||
$ hledger -f- register date:2019 date:2019-02
|
||||
> !/2019-01-01/
|
||||
$ hledger -f- register date:2019-02 date:2019
|
||||
@ -56,27 +53,27 @@ $ hledger -f- register date:2019-02 date:2019
|
||||
$ hledger -f- register date:2019-02 date:2019-01-01-
|
||||
> !/2019-01-01/
|
||||
|
||||
## Date options override date queries
|
||||
## ** 0. Date options override date queries
|
||||
#$ hledger -f- register date:2019-02 -p 2019
|
||||
#> /2019-01-01/
|
||||
|
||||
# Smart dates https://github.com/simonmichael/hledger/issues/1079
|
||||
# ** 0. Smart dates https://github.com/simonmichael/hledger/issues/1079
|
||||
$ hledger -f- activity -b 2019-02-01 -e 'next year'
|
||||
> /2019-02-01 \*/
|
||||
|
||||
# Date ranges
|
||||
# ** 0. Date ranges
|
||||
# Dotted range syntax, full dates
|
||||
$ hledger -f- reg date:2019-01-01..2019-02-01
|
||||
2019-01-01 (a) 2 2
|
||||
|
||||
# Dotted range syntax, partial dates
|
||||
# ** 0. Dotted range syntax, partial dates
|
||||
$ hledger -f- reg date:2019-01..2019-02
|
||||
2019-01-01 (a) 2 2
|
||||
|
||||
# Dashed range syntax, full dates
|
||||
# ** 0. Dashed range syntax, full dates
|
||||
$ hledger -f- reg date:2019-01-01-2019-02-01
|
||||
2019-01-01 (a) 2 2
|
||||
|
||||
# Dashed range syntax, partial dates
|
||||
# ** 0. Dashed range syntax, partial dates
|
||||
$ hledger -f- reg date:2019-01-2019-02
|
||||
2019-01-01 (a) 2 2
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
# * report intervals, register command
|
||||
|
||||
# Input for the following tests:
|
||||
|
||||
2019-01-01
|
||||
(a) 2
|
||||
|
||||
2019-02-01
|
||||
(a) 1
|
||||
|
||||
# ** 1. The last report interval option takes precedence.
|
||||
$ hledger -f- register --weekly --monthly
|
||||
2019-01 a 2 2
|
||||
2019-02 a 1 3
|
||||
|
||||
# ** 2.
|
||||
$ hledger -f- register --monthly --weekly
|
||||
2018-W01 a 2 2
|
||||
2019-W05 a 1 3
|
||||
|
||||
# ** 3. The last report interval option (--weekly) takes precedence,
|
||||
# including over a -p option.
|
||||
# The -p option's "in 2019" sets an explicit start date here.
|
||||
$ hledger -f- register -p 'monthly in 2019' --weekly
|
||||
2019-01-01..2019-01-07 a 2 2
|
||||
2019-01-29..2019-02-04 a 1 3
|
||||
|
||||
# ** 4.
|
||||
$ 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'
|
||||
# ** 5.
|
||||
$ hledger -f- register --monthly -p 2019
|
||||
2019-01 a 2 2
|
||||
2019-02 a 1 3
|
||||
|
||||
# ** 6.
|
||||
$ hledger -f- register -p 2019 --monthly
|
||||
2019-01 a 2 2
|
||||
2019-02 a 1 3
|
||||
|
||||
# ** 7.
|
||||
$ hledger -f- register -p 'monthly in 2019'
|
||||
2019-01 a 2 2
|
||||
2019-02 a 1 3
|
||||
@ -111,3 +111,28 @@ $ hledger -f- register -p 'weekly from 2014-01-27 to 2014-03' -E
|
||||
2014-W07 0 10
|
||||
2014-W08 0 10
|
||||
2014-W09 expanded report period 100 110
|
||||
|
||||
# ** 10. The last report interval option takes precedence.
|
||||
# Also, here the -p option specifies an explicit start date which is used,
|
||||
# and the end date is adjusted to contain a whole number of report intervals,
|
||||
# overriding the specified end date.
|
||||
<
|
||||
2019-01-01
|
||||
(a) 2
|
||||
|
||||
2019-02-01
|
||||
(a) 1
|
||||
|
||||
$ hledger -f- register -p 'weekly from 2019/2/1 to 2019/6/1' --monthly --yearly
|
||||
2019-02-01..2020-01-31 a 1 1
|
||||
|
||||
# --monthly and -p 'monthly ...' are equivalent (#1008):
|
||||
# ** 11. --monthly
|
||||
$ hledger -f- register --monthly
|
||||
2019-01 a 2 2
|
||||
2019-02 a 1 3
|
||||
|
||||
# ** 12. -p 'monthly'
|
||||
$ hledger -f- register -p monthly
|
||||
2019-01 a 2 2
|
||||
2019-02 a 1 3
|
||||
|
||||
Loading…
Reference in New Issue
Block a user