hledger/tests/journal/status.test
Simon Michael 5d28120f6d lib: multiple status: query terms are OR'd (#564)
Like desc: and acct:. I think this is more intuitive and useful,
so now eg "status: status:!" works (equivalent to -UP or "not:status:*").
2017-06-15 19:16:39 -07:00

116 lines
2.2 KiB
Plaintext

## parsing
# 1. transactions and postings have status marks which are nothing, ! or *
hledger -fstatus.journal print
>>>
2017/01/01 uncleared
(a) 1
(b) 1
2017/01/02 ! pending
(a) 1
! (b) 1
2017/01/03 * cleared
(a) 1
* (b) 1
>>>=0
# 2. other characters will be considered part of the description
hledger -f- print desc:%
<<<
2017/01/01 %
>>>
2017/01/01 %
>>>=0
## matching with flags
# 3. --cleared matches * only
hledger -fstatus.journal print --cleared
>>>
2017/01/03 * cleared
(a) 1
* (b) 1
>>>=0
# 4. --pending matches ! only
hledger -fstatus.journal print --pending
>>>
2017/01/02 ! pending
(a) 1
! (b) 1
>>>=0
# 5. --uncleared matches everything but *
hledger -fstatus.journal print --uncleared
>>>
2017/01/01 uncleared
(a) 1
(b) 1
>>>=0
# 6. these flags can be combined
hledger -fstatus.journal register --uncleared --pending
>>>
2017/01/01 uncleared (a) 1 1
(b) 1 2
2017/01/02 pending (a) 1 3
(b) 1 4
>>>= 0
# 7. these flags work with other commands
hledger -fstatus.journal balance -N --uncleared
>>>
1 a
1 b
>>>=0
## matching with status: query
# 8. status:* matches * only
hledger -fstatus.journal print status:*
>>>
2017/01/03 * cleared
(a) 1
* (b) 1
>>>=0
# 9. status:! matches ! only
hledger -fstatus.journal print status:!
>>>
2017/01/02 ! pending
(a) 1
! (b) 1
>>>=0
# 10. status: matches unmarked only
hledger -fstatus.journal print status:
>>>
2017/01/01 uncleared
(a) 1
(b) 1
>>>=0
# 11. multiple status: queries are OR'd
hledger -fstatus.journal print status: status:!
>>>
2017/01/01 uncleared
(a) 1
(b) 1
2017/01/02 ! pending
(a) 1
! (b) 1
>>>= 0