;dev: tests: add outshine headings for more readability (in emacs)

This commit is contained in:
Simon Michael 2023-10-28 23:38:05 +01:00
parent 48732e6655
commit 65efc8b87f
124 changed files with 1110 additions and 951 deletions

View File

@ -1,6 +1,6 @@
# Run unit tests.
# * Run unit tests.
# 1. all tests passed
# ** 1. all tests passed
$ hledger test
> //
>=0

View File

@ -1,4 +1,4 @@
# Tests for bin/hledger-move.hs
# * bin/hledger-move.hs
2022/01/01
(f) 1
@ -7,14 +7,12 @@
(n) -1
(t) 0
comment
# 1. TOACCT must exist
# ** 1. TOACCT must exist
$ hledger-move -f- --today=2000-01-01 0 f unknown
>2 /Error: unknown did not match any account./
>=1
# 2. Can create an entry moving zero
# ** 2. Can create an entry moving zero
$ hledger-move -f- --today=2000-01-01 0 f t
2000-01-01
f 0
@ -22,7 +20,7 @@ $ hledger-move -f- --today=2000-01-01 0 f t
>=
# 3. Funds are moved from parent account first
# ** 3. Funds are moved from parent account first
$ hledger-move -f- --today=2000-01-01 1 f t
2000-01-01
f -1
@ -30,7 +28,7 @@ $ hledger-move -f- --today=2000-01-01 1 f t
>=
# 4. Then from subaccounts as needed
# ** 4. Then from subaccounts as needed
$ hledger-move -f- --today=2000-01-01 2 f t
2000-01-01
f -1
@ -40,22 +38,22 @@ $ hledger-move -f- --today=2000-01-01 2 f t
>=
# 5. Insufficient funds to move gives an error
# ** 5. Insufficient funds to move gives an error
$ hledger-move -f- --today=2000-01-01 10 f t
>2 /Error: could not move 10, only 3 is available/
>=1
# 6. And you can't move funds from a negative balance
# ** 6. And you can't move funds from a negative balance
$ hledger-move -f- --today=2000-01-01 1 n t
>2 /Error: could not move 1, only -1 is available/
>=1
# 7. A negative amount is not easily entered
# ** 7. A negative amount is not easily entered
$ hledger-move -f- --today=2000-01-01 '-1' f t
>2 /Error: Unknown flag: -1/
>=1
# 8. It can be done with -- (and hledger-move, not hledger move), but will be rejected.
# ** 8. It can be done with -- (and hledger-move, not hledger move), but will be rejected.
$ hledger-move -f- --today=2000-01-01 -- -1 f t
>2 /please specify a positive amount/
>=1

View File

@ -1,8 +1,8 @@
# alias-related tests
# * account alias tests
# simple aliases
# 1. simple alias directive
# ** 1. simple alias directive
<
alias checking = assets:bank:checking
1/1
@ -10,7 +10,7 @@ alias checking = assets:bank:checking
$ hledger -f- accounts
assets:bank:checking:a
# 2. simple alias matches whole account name components only
# ** 2. simple alias matches whole account name components only
<
alias a:b = A:B
1/1
@ -21,7 +21,7 @@ $ hledger -f- accounts
A:B:c
a:bb:d
# 3. a simple alias matching the whole account name works
# ** 3. a simple alias matching the whole account name works
<
alias a:b = A:B
1/1
@ -31,7 +31,7 @@ A:B
# regular expression aliases
# 4. regex alias directive
# ** 4. regex alias directive
<
alias /^(.+):bank:([^:]+):?(.*)/ = \1:\2 \3
1/1
@ -39,7 +39,7 @@ alias /^(.+):bank:([^:]+):?(.*)/ = \1:\2 \3
$ hledger -f- accounts
assets:B checking:a
# 5. regex alias pattern is a case-insensitive regular expression
# ** 5. regex alias pattern is a case-insensitive regular expression
# matching anywhere in the account name. All matching aliases are
# applied to an account name in turn, most recently seen first. The
# replacement can replace multiple matches within the account name.
@ -75,7 +75,7 @@ $ hledger -f- print
# CLI
# 6. --alias command-line options are applied in the order written.
# ** 6. --alias command-line options are applied in the order written.
# Spaces are allowed if quoted.
#
<
@ -92,7 +92,7 @@ $ hledger -f- print --alias '/A (.)/=a' --alias /a/=b
>=0
# 7. alias options are applied after alias directives.
# ** 7. alias options are applied after alias directives.
#
<
alias /^a/=B
@ -110,7 +110,7 @@ $ hledger -f- print --alias /a/=A --alias /B/=C --alias /B/=D --alias /C/=D
>=0
# 8. alias options
# ** 8. alias options
<
01/01 Opening balances
(bank) 100
@ -137,7 +137,7 @@ $ hledger -f- balance --alias=cc=credit-card --alias=b=bank
--------------------
90
# 9. query will search both origin and substitution in alias
# ** 9. query will search both origin and substitution in alias
<
alias a = b
2017/1/1
@ -149,7 +149,7 @@ $ hledger -f- reg '^a$' '^b$'
# recursive aliases https://github.com/simonmichael/hledger/issues/1055
# 10. Recursive command line simple aliases.
# ** 10. Recursive command line simple aliases.
<
2000/01/01
(one) 1
@ -160,7 +160,7 @@ $ hledger -f- --alias "one=two" --alias "two=three" print
>=0
# 11. Recursive simple alias directives. Note the reverse order,
# ** 11. Recursive simple alias directives. Note the reverse order,
# alias directives are applied most recent first (bottom up).
<
alias two = three
@ -174,7 +174,7 @@ $ hledger -f- print
>=0
# 12. Only one of these is applied.
# ** 12. Only one of these is applied.
<
alias one = three
alias one = two
@ -187,7 +187,7 @@ $ hledger -f- print
>=0
# 13. Recursive command line regexp aliases.
# ** 13. Recursive command line regexp aliases.
<
2000/01/01
(one) 1
@ -198,7 +198,7 @@ $ hledger -f- --alias "/one/=two" --alias "/two/=three" print
>=0
# 14. Recursive regexp alias directives.
# ** 14. Recursive regexp alias directives.
# Alias directives are applied most recent first (bottom up).
<
alias /two/ = three
@ -212,7 +212,7 @@ $ hledger -f- print
>=0
# 15. Only one of these is applied.
# ** 15. Only one of these is applied.
<
alias /one/ = three
alias /one/ = two
@ -226,7 +226,7 @@ $ hledger -f- print
>=0
# Aliases can produce malformed account names and invalid print output (#1788).
# 16. For example, you can erase an account name:
# ** 16. For example, you can erase an account name:
<
alias /a:.*/=
2021-01-01
@ -239,7 +239,7 @@ $ hledger -f- print
>=0
# 17. Another example: you can insert an illegal double space,
# ** 17. Another example: you can insert an illegal double space,
# with the second part considered part of the amount if reparsed:
<
2021-01-01
@ -253,7 +253,7 @@ $ hledger -f- --alias old="new USD" print | hledger -f- print
>=0
# 18. Make sure you can match forward slashes in regexps by escaping them. (#982)
# ** 18. Make sure you can match forward slashes in regexps by escaping them. (#982)
<
alias /\// = :
@ -268,7 +268,7 @@ $ hledger -f- print
>=0
# 19. Make sure you can escape special regexp characters.
# ** 19. Make sure you can escape special regexp characters.
<
alias /\./ = :
@ -283,7 +283,7 @@ $ hledger -f- print
>=0
# 20. Including backslashes
# ** 20. Including backslashes
<
alias /\\/ = :

View File

@ -1,6 +1,6 @@
# accounts report sorting.
# * accounts report sorting.
# 1. Accounts are sorted alphabetically, at each tree level.
# ** 1. Accounts are sorted alphabetically, at each tree level.
# Flat mode. Unused parent accounts are not added (b).
<
2018/1/1
@ -23,7 +23,7 @@ c
>=
# 2. Tree mode. Missing parent accounts are added (b).
# ** 2. Tree mode. Missing parent accounts are added (b).
$ hledger -f- acc --tree
a
k
@ -33,7 +33,7 @@ b
c
>=
# 3. With account directives, flat mode.
# ** 3. With account directives, flat mode.
# At each tree level, declared accounts are sorted first, in
# declaration order, followed by undeclared accounts sorted alphabetically.
# Unused parent accounts are not added (b).
@ -70,7 +70,7 @@ b:i
c
>=
# 4. With account directives, tree mode.
# ** 4. With account directives, tree mode.
# Missing parent accounts are added (b).
$ hledger -f- acc --tree
d
@ -83,7 +83,7 @@ b
c
>=
# 5. With a depth limit:
# ** 5. With a depth limit:
# deeper accounts are not excluded
# account names are clipped
# empty clipped names are removed

View File

@ -1,6 +1,6 @@
# accounts command
# * accounts command
# 1. basic accounts report
# ** 1. basic accounts report
<
account a
@ -11,26 +11,26 @@ $ hledger -f - accounts
a
a:aa
# 2. tree mode
# ** 2. tree mode
$ hledger -f - accounts --tree
a
aa
# 3. drop in flat mode
# ** 3. drop in flat mode
$ hledger -f - accounts --flat --drop 1
...
aa
# 4. drop in tree mode
# ** 4. drop in tree mode
$ hledger -f - accounts --tree --drop 1
...
aa
# 5. filtering transactions by tag
# ** 5. filtering transactions by tag
$ hledger -f - accounts tag:foo
a:aa
# 6. Show account types.
# ** 6. Show account types.
<
account asset
2022-01-01

View File

@ -1,4 +1,5 @@
# 1. activity report is daily by default.
# * activity command
# ** 1. activity report is daily by default.
<
2023-01-01
(a) 1
@ -14,7 +15,7 @@ $ hledger -f - activity
2023-01-05
2023-01-06 *
# 2. A weekly activity report.
# ** 2. A weekly activity report.
<
2023-01-01
(a) 1
@ -26,7 +27,7 @@ $ hledger -f - activity -W
2022-12-26 *
2023-01-02 *
# 2. A 7-day activity report starting on an date.
# ** 2. A 7-day activity report starting on an date.
<
2023-01-01
(a) 1

View File

@ -1,14 +1,15 @@
# * add command
##############################################################################
# data validation
#
# 1. should prompt again for a bad date
# ** 1. should prompt again for a bad date
<<<
2009/1/32
$$$ hledger -f $$-add.j add; rm -f $$-add.j
>>> /A valid hledger smart date is required/
>>>2 //
# 2. should accept a blank date
# ** 2. should accept a blank date
<<<
$$$ hledger -f $$-add.j add; rm -f $$-add.j
@ -18,7 +19,7 @@ $$$ hledger -f $$-add.j add; rm -f $$-add.j
##############################################################################
# precision and commodity handling
#
# 3. simple add with no existing journal, no commodity entered
# ** 3. simple add with no existing journal, no commodity entered
<<<
@ -31,7 +32,7 @@ $$$ hledger -f $$-add.j add; rm -f $$-add.j
>>> /Date.*Description.*Account 1.*Amount 1.*Account 2.*Amount 2.*Account 3.*or \. or enter to finish.*/
>>>2 //
# 4. default commodity with greater precision
# ** 4. default commodity with greater precision
<<<
@ -45,7 +46,7 @@ $$$ printf 'D $1000.00\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; r
>>> /a +\$1000\.0/
>>>2 //
# 5. default commodity with less precision
# ** 5. default commodity with less precision
<<<
@ -59,7 +60,7 @@ $$$ printf 'D $1000.0\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm
>>> /a +\$1000\.00/
>>>2 //
# 6. existing commodity with greater precision
# ** 6. existing commodity with greater precision
<<<
@ -72,7 +73,7 @@ $$$ printf '2010/1/1\n a $1000.00\n b\n' >t$$.j; hledger -f t$$.j add >/dev/nu
>>> /a +\$1000\.0/
>>>2 //
# 7. existing commodity with less precision
# ** 7. existing commodity with less precision
<<<
@ -86,7 +87,7 @@ $$$ printf '2010/1/1\n a $1000.0\n b\n' >t$$.j; hledger -f t$$.j add >/dev/nul
>>> /a +\$1000\.00/
>>>2 //
# 8. default amounts should not fail to balance due to precision
# ** 8. default amounts should not fail to balance due to precision
<<<
2010/1/1
x

View File

@ -1,25 +1,27 @@
# * add-on command subsystem tests
#
# "make test" sets up the dummy add-on scripts required for these tests
#
# Note because of the PATH setting these don't obey shelltest -w,
# they always run the first hledger executable in PATH
# 1. flags after an add-command are handled by the add-on
# ** 1. flags after an add-command are handled by the add-on
$ PATH=$PATH:. hledger addon --help
> /hledger-addon/
>=0
# 2. add-on flags which are not also defined in the main executable are a problem
# ** 2. add-on flags which are not also defined in the main executable are a problem
$ PATH=$PATH:. hledger addon --addonflag
>2 /Unknown flag: --addonflag/
>=1
# 3. hledger main executable ignores anything after -- (and hides the -- from the add-on)
# ** 3. hledger main executable ignores anything after -- (and hides the -- from the add-on)
$ PATH=$PATH:. hledger addon --help -- --addonflag
> /hledger-addon/
>=0
# TODO how to reliably ensure no addons but still find the hledger executable ?
# 4. having no addons shouldn't break the commands list
# ** 4. having no addons shouldn't break the commands list
# $ PATH= ~/.local/bin/stack exec -- hledger
# >=0

View File

@ -1,5 +1,5 @@
# amount layout tests, using default vertical layout
# 1. print
# * amount layout tests, using default vertical layout
# ** 1. print
<
2010/1/1
a EUR 1 ; a euro
@ -14,7 +14,7 @@ $ hledger -f - print --explicit
>= 0
# 2. register
# ** 2. register
<
2010/1/1
a EUR 1 ; a euro
@ -27,7 +27,7 @@ $ hledger -f - register
c EUR -1
USD -1 0
# 3. balance
# ** 3. balance
<
2010/1/1
a EUR 1 ; a euro
@ -39,7 +39,7 @@ $ hledger -f - balance -N
EUR -1
USD -1 c
# 4. a single-commodity zero amount's commodity/decimal places/price is preserved, when possible
# ** 4. a single-commodity zero amount's commodity/decimal places/price is preserved, when possible
<
2010/3/1 x
a $0.00 @ 3EUR
@ -51,7 +51,7 @@ $ hledger -f- print --explicit --empty
>= 0
# 5.
# ** 5.
# When preserving a zero amount's commodity, we should also preserve
# the amount style, such as where to place the symbol.
# https://github.com/simonmichael/hledger/issues/230
@ -72,7 +72,7 @@ $ hledger -f- balance --tree -N
-3000,00€ e
# 5. mixed amounts with prices
# ** 5. mixed amounts with prices
# XXX
# hledger -f - print
# <<<

View File

@ -1,3 +1,5 @@
# * aregister command
<
2021-01-01
(b) 1
@ -6,7 +8,7 @@
a 1
b -1
# 1. aregister only shows transactions matching the account query, and displays other accounts involved
# ** 1. aregister only shows transactions matching the account query, and displays other accounts involved
$ hledger -f- areg a
Transactions in a and subaccounts:
2021-01-02 b 1 1
@ -20,7 +22,7 @@ Transactions in a and subaccounts:
assets:checking -2
expenses:food 2
# 2. aregister ignores a depth limit, always showing transactions in subaccounts. #1448
# ** 2. aregister ignores a depth limit, always showing transactions in subaccounts. #1448
$ hledger -f- areg checking depth:1
Transactions in assets:checking and subaccounts:
2023-01-01 in:salary 1 1
@ -28,19 +30,19 @@ Transactions in assets:checking and subaccounts:
#1634:
# 3. aregister is always in historical mode, showing balance from prior transactions.
# ** 3. aregister is always in historical mode, showing balance from prior transactions.
$ hledger -f- areg checking -b 2023-01-02
Transactions in assets:checking and subaccounts:
2023-01-02 ex:food -2 -1
# 4. Any additional arguments are a query filtering the transactions. #2007
# ** 4. Any additional arguments are a query filtering the transactions. #2007
# This can cause the running balance to diverge from the real-world running balance.
# For non-date/date2/depth queries, a hint is shown in the title.
$ hledger -f- areg checking expenses
Transactions in assets:checking and subaccounts (matching query):
2023-01-02 ex:food -2 -2
# 5. Sorts transactions first by transaction date (earliest date of the
# ** 5. Sorts transactions first by transaction date (earliest date of the
# matching postings) then by parse order. (#1642)
# Also, make sure to use the posting date of matching transactions, if it
# differs from the transaction date.
@ -89,7 +91,7 @@ Transactions in a and subaccounts:
a 1 C
b -1 C
# 6. aregister correctly aligns amounts when there are multiple commodities (#1656).
# ** 6. aregister correctly aligns amounts when there are multiple commodities (#1656).
$ hledger -f- areg a
Transactions in a and subaccounts:
2021-01-01 b, c 1 A 1 A
@ -103,7 +105,7 @@ Transactions in a and subaccounts:
2021-01-01=2021-02-02
(a) 1
# 7. With --date2, it should show the secondary transaction date.
# ** 7. With --date2, it should show the secondary transaction date.
$ hledger -f- areg a --date2
Transactions in a and subaccounts:
2021-02-02 a 1 1

View File

@ -1,5 +1,5 @@
# issue 219, --tree and --flat flags should override each other cleanly
# 1. multiple flags ending with --flat, equivalent to --flat
# * issue #219, --tree and --flat flags should override each other cleanly
# ** 1. multiple flags ending with --flat, equivalent to --flat
$ hledger -f balance-multicol.journal bal -MH --no-elide --no-total date:2013/1 --tree --flat
Ending balances (historical) in 2013-01:
@ -7,7 +7,7 @@ Ending balances (historical) in 2013-01:
=================++============
assets:checking || 10
# 2. multiple flags ending with --tree, equivalent to --tree
# ** 2. multiple flags ending with --tree, equivalent to --tree
$ hledger -f balance-multicol.journal bal -MH --no-elide --no-total date:2013/1 --flat --tree
Ending balances (historical) in 2013-01:

View File

@ -1,4 +1,4 @@
# Account name eliding and indenting tests, cf issue 373.
# Account name eliding and indenting tests, cf issue #373.
# Documenting current behaviour, some of which looks wrong.
# This file uses https://github.com/simonmichael/shelltestrunner#format-3
@ -15,21 +15,21 @@
1:2:3:4:5 1
1 -1
# 1. simple balance report in tree mode with zero/boring parents
# ** 1. simple balance report in tree mode with zero/boring parents
$ hledger -f - bal --tree -N
0 1:2
1 3
0 4
1 5
# 2. simple balance report in flat mode
# ** 2. simple balance report in flat mode
$ hledger -f - bal --flat -N
-1 1:2
1 1:2:3
-1 1:2:3:4
1 1:2:3:4:5
# 3. tabular balance report in flat mode
# ** 3. tabular balance report in flat mode
$ hledger -f - bal -Y
Balance changes in 2015:
@ -42,7 +42,7 @@ Balance changes in 2015:
-----------++------
|| 0
# 4. tabular balance report in tree mode, showing boring parents
# ** 4. tabular balance report in tree mode, showing boring parents
$ hledger -f - bal -Y --tree --no-elide
Balance changes in 2015:
@ -56,7 +56,7 @@ Balance changes in 2015:
-----------++------
|| 0
# 5. tabular balance report in tree mode, hiding zero accounts
# ** 5. tabular balance report in tree mode, hiding zero accounts
# Undisplayed parent accounts should be mentioned in the displayed account names as necessary
$ hledger -f - bal -Y --tree
Balance changes in 2015:
@ -70,6 +70,6 @@ Balance changes in 2015:
---------++------
|| 0
# 6. TODO: after 5, test account code sorting
# ** 6. TODO: after 5, test account code sorting
# account 1:2:3 100
# account 1:2:3:4:5 200

View File

@ -1,4 +1,5 @@
# 1. issue 87, hledger should give this balance.
# * issue #87
# ** 1. hledger should give this balance.
hledger -f - balance --no-total b
<<<
1/1
@ -25,7 +26,7 @@ hledger -f - balance --no-total b
-969.81 b
>>>= 0
# 2. As above, but the prices have a commodity - should work the same.
# ** 2. As above, but the prices have a commodity - should work the same.
hledger -f - balance --no-total b
<<<
1/1

View File

@ -1,4 +1,5 @@
# 1.
# * balance command
# ** 1.
$ hledger -f sample.journal balance --tree
$-1 assets
$1 bank:saving
@ -13,7 +14,7 @@ $ hledger -f sample.journal balance --tree
--------------------
0
# 2.
# ** 2.
$ hledger -f sample.journal balance --tree o
$1 expenses:food
$-2 income
@ -22,7 +23,7 @@ $ hledger -f sample.journal balance --tree o
--------------------
$-1
# 3. Period reporting works for a specific year
# ** 3. Period reporting works for a specific year
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -48,7 +49,7 @@ $ hledger -f - balance -b 2016 -e 2017 -N
$50.00 expense:hosting
$-10.00 revenue:clients:B
# 4. Period reporting works for two years
# ** 4. Period reporting works for two years
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -76,7 +77,7 @@ $ hledger -f - balance --tree -b 2015 -e 2017 -N
$-10,000.00 A
$-10.00 B
# 5. Period reporting works for one month
# ** 5. Period reporting works for one month
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -102,7 +103,7 @@ $ hledger -f - balance --tree -b 2015/11 -e 2015/12 -N
$10,000.00 checking
$-10,000.00 receivables
# 6. Period reporting works for one month in another year
# ** 6. Period reporting works for one month in another year
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -127,7 +128,7 @@ $ hledger -f - balance -b 2016/10 -e 2016/11
--------------------
0
# 7. Default CSV output.
# ** 7. Default CSV output.
<
2021-01-01 Test
Assets:ABC "AB.C" 1
@ -137,7 +138,7 @@ $ hledger -f - balance -N --output-format=csv
"Assets:ABC","""AB.C"" 1"
"Assets:Cash","$-1"
# 8. CSV output always shows full account names, even in tree mode (#1565).
# ** 8. CSV output always shows full account names, even in tree mode (#1565).
<
2021-01-01 Test
Assets:ABC "AB.C" 1
@ -148,7 +149,7 @@ $ hledger -f - balance -N --output-format=csv --tree
"Assets:ABC","""AB.C"" 1"
"Assets:Cash","$-1"
# 9. CSV output always does not show thousands separators
# ** 9. CSV output always does not show thousands separators
<
2021-01-01 Test
Assets:ABC $10 000.00
@ -158,7 +159,7 @@ $ hledger -f - balance -N --output-format=csv
"Assets:ABC","$10000.00"
"Assets:Cash","$-10000.00"
# 10. --declared includes all declared leaf accounts, even if they have no postings.
# ** 10. --declared includes all declared leaf accounts, even if they have no postings.
# They are filtered, depth-clipped, and form trees like the others.
# (XXX Here a:ac is not declared and so not shown, even though normally a balance report clipped to depth 2 would show it. Wrong ?)
<
@ -172,7 +173,7 @@ $ hledger -f - balance -NE --declared --tree --depth 2 a
0 aa
0 ab
# 11. In list mode we can see that non-leaf declared accounts are excluded.
# ** 11. In list mode we can see that non-leaf declared accounts are excluded.
<
account a
account a:aa
@ -185,7 +186,7 @@ $ hledger -f - balance -NE --declared --flat
0 a:ac:aca
0 b
# 12. not:ACCT queries work with declared accounts.
# ** 12. not:ACCT queries work with declared accounts.
<
account a
account a:aa
@ -195,17 +196,17 @@ account b
$ hledger -f - balance -NE --declared not:a
0 b
# 13. An empty periodic report in HTML output does not break.
# ** 13. An empty periodic report in HTML output does not break.
<
$ hledger -f- bal -M -O html
> //
# 14. An empty totals column in HTML output does not break (#1933).
# ** 14. An empty totals column in HTML output does not break (#1933).
<
$ hledger -f- bal -MT -O html
> //
# 15. --count counts postings.
# ** 15. --count counts postings.
<
2023-01-01
a 10

View File

@ -1,4 +1,4 @@
# balance --budget tests
# * balance --budget tests
2016/12/01
expenses:food $10
@ -30,7 +30,7 @@
assets:cash
# 1. Test --budget switch
# ** 1. Test --budget switch
$ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget
Budget performance in 2016-12-01..2016-12-03:
@ -43,7 +43,7 @@ Budget performance in 2016-12-01..2016-12-03:
------------------++--------------------------------------------------------------
|| 0 [ 0] 0 [ 0] 0 [ 0]
# 2. -E
# ** 2. -E
$ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget -E
Budget performance in 2016-12-01..2016-12-03:
@ -58,7 +58,7 @@ Budget performance in 2016-12-01..2016-12-03:
------------------++--------------------------------------------------------------
|| 0 [ 0] 0 [ 0] 0 [ 0]
# 3. Test that budget works with mix of commodities
# ** 3. Test that budget works with mix of commodities
<
2016/12/01
expenses:food £10 @@ $15
@ -105,7 +105,7 @@ Budget performance in 2016-12-01..2016-12-03:
------------------++---------------------------------------------------------------------------
|| $-15, £10 [ 0] $-21, 20 CAD [ 0] 0 [ 0]
# 4. --budget with no interval shows total budget for the journal period
# ** 4. --budget with no interval shows total budget for the journal period
# (in tabular format).
<
~ daily
@ -138,7 +138,7 @@ Budget performance in 2018-01-01..2018-01-03:
---++------------------------
|| 6 [1% of 1130]
# 5. Multiple periodic transactions with different intervals are combined.
# ** 5. Multiple periodic transactions with different intervals are combined.
# Budget goals with lower frequency than the report are posted in the
# appropriate intermittent periods.
$ hledger -f- bal --budget -D
@ -152,7 +152,7 @@ Budget performance in 2018-01-01..2018-01-03:
---++----------------------------------------------
|| 3 [ 0% of 1110] 0 [0% of 10] 3 [30% of 10]
# 6. Budget goals with higher frequency than the report get added up appropriately.
# ** 6. Budget goals with higher frequency than the report get added up appropriately.
$ hledger -f- bal --budget -W
Budget performance in 2018-01-01W01:
@ -164,7 +164,7 @@ Budget performance in 2018-01-01W01:
---++----------------
|| 6 [1% of 1170]
# 7. A bounded two day budget. The end date is exclusive as usual.
# ** 7. A bounded two day budget. The end date is exclusive as usual.
<
~ daily from 2018/1/2 to 2018/1/4
(a) 1
@ -195,7 +195,7 @@ Budget performance in 2018-01-01..2018-01-04:
--------------++------------------------------------------------------
|| 2 2 [200% of 1] 2 [200% of 1] 2
# 8. Multiple bounded budgets.
# ** 8. Multiple bounded budgets.
<
~ daily from 2018/1/1 to 2018/1/3
(a) 1
@ -224,7 +224,7 @@ Budget performance in 2018-01-01..2018-01-04:
---++------------------------------------------------------------
|| 1 [100% of 1] 1 [100% of 1] 1 [10% of 10] 1 [10% of 10]
# 9. A "from A to B" budget should not be included in a report beginning on B.
# ** 9. A "from A to B" budget should not be included in a report beginning on B.
$ hledger -f- bal --budget -D -b 2018/1/3
Budget performance in 2018-01-03..2018-01-04:
@ -244,7 +244,7 @@ Budget performance in 2018-01-03..2018-01-04:
2018/1/2
(a) -2
# 10. accounts with non-zero budget should be shown by default
# ** 10. accounts with non-zero budget should be shown by default
# even if there are no actual transactions in the period,
# or if the actual amount is zero.
$ hledger -f- bal --budget -D date:2018/1/1-2018/1/3
@ -256,7 +256,7 @@ Budget performance in 2018-01-01..2018-01-02:
---++--------------------------
|| 0 [0% of 1] 0 [0% of 1]
# 11. With -E, zeroes are shown
# ** 11. With -E, zeroes are shown
$ hledger -f- bal --budget -D date:2018/1/1-2018/1/3 -E
Budget performance in 2018-01-01..2018-01-02:
@ -266,7 +266,7 @@ Budget performance in 2018-01-01..2018-01-02:
---++--------------------------
|| 0 [0% of 1] 0 [0% of 1]
# 12. subaccounts of budgeted accounts count towards budget
# ** 12. subaccounts of budgeted accounts count towards budget
<
~ daily
(a) 1
@ -281,7 +281,7 @@ Budget performance in 2018-01-01:
===++===============
a || 1 [100% of 1]
# 13. budget goals on both parent and subaccounts are counted
# ** 13. budget goals on both parent and subaccounts are counted
<
~ daily
(a) 100
@ -301,7 +301,7 @@ Budget performance in 2018-01-01:
-------++-----------------
|| 2 [ 2% of 101]
# 14. tree mode
# ** 14. tree mode
$ hledger -f- bal --budget --tree
Budget performance in 2018-01-01:
@ -316,7 +316,7 @@ Budget performance in 2018-01-01:
# TODO: respect --sort-amount
# 15. respect --value
# ** 15. respect --value
<
P 2018/01/26 SHARE €10
@ -344,7 +344,7 @@ Budget performance in 2018-05-01..2018-06-30, valued at period ends:
----------------++---------------------------------
|| 0 0 [ 0]
# 16. With subaccounts, child accounts are properly included in the parent balance when budget is checked
# ** 16. With subaccounts, child accounts are properly included in the parent balance when budget is checked
<
~ monthly from 2019/01
expenses:personal $1000.00
@ -372,7 +372,7 @@ Budget performance in 2019-01-01..2019-01-03:
-------------------++---------------------------
|| 0 [ 0]
# 17.
# ** 17.
$ hledger -f- bal --budget -E
Budget performance in 2019-01-01..2019-01-03:
@ -385,7 +385,7 @@ Budget performance in 2019-01-01..2019-01-03:
----------------------------------------++---------------------------
|| 0 [ 0]
# 18.
# ** 18.
$ hledger -f- bal --budget --tree
Budget performance in 2019-01-01..2019-01-03:
@ -396,7 +396,7 @@ Budget performance in 2019-01-01..2019-01-03:
-------------------++---------------------------
|| 0 [ 0]
# 19.
# ** 19.
$ hledger -f- bal --budget --tree -E
Budget performance in 2019-01-01..2019-01-03:
@ -409,7 +409,7 @@ Budget performance in 2019-01-01..2019-01-03:
-------------------++---------------------------
|| 0 [ 0]
# 20. Also should work when there are no postings directly in budgeted parents (#1800)
# ** 20. Also should work when there are no postings directly in budgeted parents (#1800)
$ hledger -f- bal -e 2019-01-02 --budget -E
Budget performance in 2019-01-01:
@ -421,7 +421,7 @@ Budget performance in 2019-01-01:
-------------------------------++---------------------------
|| 0 [ 0]
# 21. Also should work when there are no postings directly in budgeted parents with --tree (#1800)
# ** 21. Also should work when there are no postings directly in budgeted parents with --tree (#1800)
$ hledger -f- bal -e 2019-01-02 --budget --tree -E
Budget performance in 2019-01-01:
@ -433,7 +433,7 @@ Budget performance in 2019-01-01:
-------------------++---------------------------
|| 0 [ 0]
# 22. Subaccounts + nested budgets
# ** 22. Subaccounts + nested budgets
<
~ monthly from 2019/01
expenses:personal $1000.00
@ -463,7 +463,7 @@ Budget performance in 2019-01-01..2019-01-03:
-------------------------------++----------------------------
|| 0 [ 0]
# 23.
# ** 23.
$ hledger -f- bal --budget -E
Budget performance in 2019-01-01..2019-01-03:
@ -476,7 +476,7 @@ Budget performance in 2019-01-01..2019-01-03:
----------------------------------------++----------------------------
|| 0 [ 0]
# 24.
# ** 24.
$ hledger -f- bal --budget --tree
Budget performance in 2019-01-01..2019-01-03:
@ -488,7 +488,7 @@ Budget performance in 2019-01-01..2019-01-03:
-------------------++----------------------------
|| 0 [ 0]
# 25.
# ** 25.
$ hledger -f- bal --budget --tree -E
Budget performance in 2019-01-01..2019-01-03:
@ -501,7 +501,7 @@ Budget performance in 2019-01-01..2019-01-03:
-------------------++----------------------------
|| 0 [ 0]
# 26. Zero budget == no budget
# ** 26. Zero budget == no budget
<
~ monthly from 2019-01
expenses:bills $100 ; bills has a $100 budget of its own, separate from subaccounts
@ -539,7 +539,7 @@ Budget performance in 2019-01-01..2019-01-02:
------------------++------------------------
|| 0 [ 0]
# 27. -E shows d and e
# ** 27. -E shows d and e
$ hledger bal -f- --budget -E
Budget performance in 2019-01-01..2019-01-02:
@ -556,7 +556,7 @@ Budget performance in 2019-01-01..2019-01-02:
------------------++------------------------
|| 0 [ 0]
# 28. The totals row shows correct totals.
# ** 28. The totals row shows correct totals.
# -T/--total and -A/--average adds those columns.
$ hledger bal -f- --budget -TA not:income
Budget performance in 2019-01-01..2019-01-02:
@ -571,7 +571,7 @@ Budget performance in 2019-01-01..2019-01-02:
------------------++--------------------------------------------------------------
|| $80 [22% of $370] $80 [22% of $370] $80 [22% of $370]
# 29. CSV output works.
# ** 29. CSV output works.
$ hledger bal -f- --budget -TA not:income -O csv
"Account","2019-01-01..2019-01-02","budget","Total","budget","Average","budget"
"expenses:bills","$80","$370","$80","$370","$80","$370"
@ -581,7 +581,7 @@ $ hledger bal -f- --budget -TA not:income -O csv
"expenses:bills:f","$10","0","$10","0","$10","0"
"Total:","$80","$370","$80","$370","$80","$370"
# 30. You would expect this to show a budget goal in jan, feb, mar.
# ** 30. You would expect this to show a budget goal in jan, feb, mar.
# But by the usual report date logic, which picks the oldest and newest
# transaction date (1/15 and 3/15) as start and end date by default,
# and since "monthly" generates transactions on the 1st,
@ -609,7 +609,7 @@ Budget performance in 2020Q1:
---------------++-----------------------------------------------------------
|| 0 [ 0% of $500] 0 [0% of $500] 0 [ 0% of $500]
# 31. Specifying the report period works around it.
# ** 31. Specifying the report period works around it.
$ hledger -f- bal --budget -M date:2020q1
Budget performance in 2020Q1:
@ -636,7 +636,7 @@ $ hledger -f- bal --budget=monthly -p 2021-01
> !/aaa/
>=
# 34. Cumulative budget report.
# ** 34. Cumulative budget report.
<
~ monthly
(a) 10
@ -656,7 +656,7 @@ Budget performance in 2022-01-01..2022-02-28:
---++---------------------------------
|| 10 [100% of 10] 15 [75% of 20]
# 35. Historical budget report.
# ** 35. Historical budget report.
$ hledger -f- bal --budget -MH -b 2022-02-01
Budget performance in 2022-02:
@ -666,7 +666,7 @@ Budget performance in 2022-02:
---++----------------
|| 15 [75% of 20]
# 36. Historical budget report where the periodic transaction has date bounds.
# ** 36. Historical budget report where the periodic transaction has date bounds.
<
~ every february 2nd from 2020/01
(a) 1
@ -680,7 +680,7 @@ Budget performance in 2020Q1:
---++--------------------------------------
|| 0 [0] 0 [0% of 1] 0 [0% of 1]
# 37. Budget report applies command line commodity styles to goal amounts (#1905).
# ** 37. Budget report applies command line commodity styles to goal amounts (#1905).
<
~ daily
(a) 1

View File

@ -1,3 +1,5 @@
# * balance command with --date2 flag
<
2009/1/1 x
a 1
@ -7,22 +9,22 @@
a 10
b
# 1. --date2 ignores postings with secondary dates outside the range
# ** 1. --date2 ignores postings with secondary dates outside the range
$ hledger -f - balance -p 'in 2009' --date2 -N
1 a
-1 b
# 2. Above but with date: queries
# ** 2. Above but with date: queries
$ hledger -f - balance date:2009 --date2 -N
1 a
-1 b
# 3. --date2 sees postings with secondary dates inside the range
# ** 3. --date2 sees postings with secondary dates inside the range
$ hledger -f - balance -p 'in 2010' --date2 -N
10 a
-10 b
# 4. Above but with date: queries
# ** 4. Above but with date: queries
$ hledger -f - balance date:2010 --date2 -N
10 a
-10 b

View File

@ -1,15 +1,17 @@
# 1.
# * balance command depth limiting
# ** 1.
$ hledger -f sample.journal balance --no-total --depth 1
$-1 assets
$2 expenses
$-2 income
$1 liabilities
# 2. Depth 0 aggregates everything into one line
# ** 2. Depth 0 aggregates everything into one line
$ hledger -f sample.journal balance --no-total --depth 0 assets
$-1 ...
# 3. Ditto in a multi-column balance report.
# ** 3. Ditto in a multi-column balance report.
$ hledger -f sample.journal balance -M -e 2008/2 --depth 0 assets
Balance changes in 2008-01:

View File

@ -1,4 +1,5 @@
# 1. Drop works in flat mode
# * balance command --drop option
# ** 1. Drop works in flat mode
<
2018/1/1
(b:j) 1
@ -42,7 +43,7 @@ $ hledger -f - balance --tree --no-total --drop 1
1 ...
>=
# 4. Drop works with csv output in tree mode
# ** 4. Drop works with csv output in tree mode
$ hledger -f - balance --tree --no-total --output-format=csv --drop 1
"account","balance"
"k","1"

View File

@ -1,8 +1,8 @@
# --flat shows inclusive balances; total balance should be that of top-level accounts (issue 94)
# # 1.
# * balance command --flat flag
# ** 1. --flat shows inclusive balances; total balance should be that of top-level accounts (issue 94)
# hledger -f - balance --flat
# <<<
# 1/1
# ** 1/1
# (a) 1
# (a:aa) 1
# >>>
@ -13,7 +13,7 @@
# >>>= 0
# --flat shows exclusive balances
# 1.
# ** 1.
<
1/1
(a:aa) 1
@ -31,7 +31,7 @@ $ hledger -f - balance --flat
5
# --flat --depth shows the same accounts, but clipped and aggregated at the depth limit
# 2.
# ** 2.
<
1/1
(a:aa) 1

View File

@ -1,6 +1,6 @@
# multi-column balance reports
# * multi-column balance reports
# 1. Here are the postings used in most tests below:
# ** 1. Here are the postings used in most tests below:
$ hledger -f balance-multicol.journal register
2012-12-31 (assets:checking) 10 10
2013-01-01 (assets:checking) 1 11
@ -9,7 +9,7 @@ $ hledger -f balance-multicol.journal register
2013-02-02 (assets) 1 12
2013-03-01 (assets:checking) 1 13
# 2. A period balance (flow) report. --no-total also works but isn't pretty.
# ** 2. A period balance (flow) report. --no-total also works but isn't pretty.
# Includes leading/trailing empty periods.
$ hledger -f balance-multicol.journal balance -p 'monthly in 2013' --no-total
Balance changes in 2013:
@ -20,7 +20,7 @@ Balance changes in 2013:
assets:cash || 0 1 0 0 0 0 0 0 0 0 0 0
assets:checking || 0 0 1 0 0 0 0 0 0 0 0 0
# 3. With --empty, includes leading/trailing empty periods
# ** 3. With --empty, includes leading/trailing empty periods
#hledger -f balance-multicol.journal balance -p 'quarterly in 2013' --empty
<
2012/12/31
@ -38,7 +38,7 @@ Balance changes in 2013:
---++--------------------------------
|| 2 0 0 0
# 4. A cumulative ending balance report. Column totals are the sum of
# ** 4. A cumulative ending balance report. Column totals are the sum of
# the highest-level displayed accounts (here, assets).
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --cumulative
Ending balances (cumulative) in 2013Q1:
@ -51,7 +51,7 @@ Ending balances (cumulative) in 2013Q1:
-----------------++------------------------------------
|| 0 2 3
# 5. With the assets:cash account excluded. As with a single-column
# ** 5. With the assets:cash account excluded. As with a single-column
# balance --flat report, or ledger's balance --flat, assets' balance
# includes the displayed subaccount and not the excluded one.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --cumulative not:cash
@ -64,7 +64,7 @@ Ending balances (cumulative) in 2013Q1:
-----------------++------------------------------------
|| 0 1 2
# 6. A historical ending balance report.
# ** 6. A historical ending balance report.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --historical
Ending balances (historical) in 2013Q1:
@ -76,7 +76,7 @@ Ending balances (historical) in 2013Q1:
-----------------++------------------------------------
|| 10 12 13
# 7. With top-level accounts excluded. As always, column totals are the sum of
# ** 7. With top-level accounts excluded. As always, column totals are the sum of
# the highest-level displayed accounts, now assets:cash and assets:checking.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' not:assets$
Balance changes in 2013Q1:
@ -88,7 +88,7 @@ Balance changes in 2013Q1:
-----------------++---------------
|| 0 1 1
# 8. cumulative:
# ** 8. cumulative:
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' not:assets$ --cumulative
Ending balances (cumulative) in 2013Q1:
@ -99,7 +99,7 @@ Ending balances (cumulative) in 2013Q1:
-----------------++------------------------------------
|| 0 1 2
# 9. historical
# ** 9. historical
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --historical
Ending balances (historical) in 2013Q1:
@ -113,7 +113,7 @@ Ending balances (historical) in 2013Q1:
# --depth
# 10. A flow report with depth limiting. The depth limit aggregates the three accounts as "assets".
# ** 10. A flow report with depth limiting. The depth limit aggregates the three accounts as "assets".
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --depth 1
Balance changes in 2013Q1:
@ -123,7 +123,7 @@ Balance changes in 2013Q1:
--------++---------------
|| 0 2 1
# 11. As above, but postings in the top-level assets account have been excluded.
# ** 11. As above, but postings in the top-level assets account have been excluded.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --depth 1 assets:
Balance changes in 2013Q1:
@ -133,7 +133,7 @@ Balance changes in 2013Q1:
--------++---------------
|| 0 1 1
# 12. A cumulative balance report with depth limiting.
# ** 12. A cumulative balance report with depth limiting.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --depth 1 --cumulative
Ending balances (cumulative) in 2013Q1:
@ -143,7 +143,7 @@ Ending balances (cumulative) in 2013Q1:
--------++------------------------------------
|| 0 2 3
# 13. A historical balance report with depth limiting.
# ** 13. A historical balance report with depth limiting.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --depth 1 --historical
Ending balances (historical) in 2013Q1:
@ -153,7 +153,7 @@ Ending balances (historical) in 2013Q1:
--------++------------------------------------
|| 10 12 13
# 14. The three multicol balance report types again, this time with --tree
# ** 14. The three multicol balance report types again, this time with --tree
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --tree
Balance changes in 2013Q1:
@ -165,7 +165,7 @@ Balance changes in 2013Q1:
------------++---------------
|| 0 2 1
# 15.
# ** 15.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --cumulative --tree
Ending balances (cumulative) in 2013Q1:
@ -177,7 +177,7 @@ Ending balances (cumulative) in 2013Q1:
------------++------------------------------------
|| 0 2 3
# 16.
# ** 16.
$ hledger -f balance-multicol.journal balance -p 'monthly from 2013' --historical --tree
Ending balances (historical) in 2013Q1:
@ -189,7 +189,7 @@ Ending balances (historical) in 2013Q1:
------------++------------------------------------
|| 10 12 13
# 17. --date2 should work
# ** 17. --date2 should work
<
2014/1/1
(a) 1
@ -207,7 +207,7 @@ Balance changes in 2014-01:
---++-----
|| 2
# 18. Here, the report interval is monthly (interval size is one month)
# ** 18. Here, the report interval is monthly (interval size is one month)
# but the explicitly-specified start date causes report periods to start there.
# And the end date is expanded to make a whole last period.
<

View File

@ -1,7 +1,8 @@
# * balance report layout
# Record a complicated real-life example. Layout is not perfect, but any
# changes should be noted and evaluated whether they improve things.
# 1. Balance report csv output with no commodity columns.
# ** 1. Balance report csv output with no commodity columns.
$ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv
>
"account","balance"
@ -9,7 +10,7 @@ $ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv
"total","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
>=0
# 2. Balance report csv output with one line per commodity (--layout=bare).
# ** 2. Balance report csv output with one line per commodity (--layout=bare).
$ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv --layout=bare
>
"account","commodity","balance"
@ -25,7 +26,7 @@ $ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv --layout=bare
"total","VHT","294.00"
>=0
# 3. Balance report output with no commodity column.
# ** 3. Balance report output with no commodity column.
$ hledger -f bcexample.hledger bal assets.*etrade -3
>
70.00 GLD
@ -41,7 +42,7 @@ $ hledger -f bcexample.hledger bal assets.*etrade -3
294.00 VHT
>=0
# 4. Balance report with commodity column.
# ** 4. Balance report with commodity column.
$ hledger -f bcexample.hledger bal assets.*etrade -3 --layout=bare
>
70.00 GLD
@ -57,7 +58,7 @@ $ hledger -f bcexample.hledger bal assets.*etrade -3 --layout=bare
294.00 VHT
>=0
# 5. Multicolumn balance report csv output with no commodity columns.
# ** 5. Multicolumn balance report csv output with no commodity columns.
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv
>
"account","2012","2013","2014","total"
@ -65,7 +66,7 @@ $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv
"total","10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT","70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT","-11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
>=0
# 6. Multicolumn balance report csv output with --layout=bare.
# ** 6. Multicolumn balance report csv output with --layout=bare.
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=bare
>
"account","commodity","2012","2013","2014","total"
@ -81,7 +82,7 @@ $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=bare
"total","VHT","106.00","18.00","170.00","294.00"
>=0
# 7. Multicolumn balance report with --layout=bare.
# ** 7. Multicolumn balance report with --layout=bare.
$ hledger -f bcexample.hledger bal -Y assets.*etrade -3 --average --layout=bare --no-total
>
Balance changes in 2012-01-01..2014-12-31:
@ -95,7 +96,7 @@ Balance changes in 2012-01-01..2014-12-31:
Assets:US:ETrade || VHT 106.00 18.00 170.00 98.00
>=0
# 8. Multicolumn balance report with --row-total, --average, and --summary-only
# ** 8. Multicolumn balance report with --row-total, --average, and --summary-only
$ hledger -f bcexample.hledger bal -Y assets.*etrade -3 --layout=bare --row-total --average --summary-only
>
Balance changes in 2012-01-01..2014-12-31:
@ -115,7 +116,7 @@ Balance changes in 2012-01-01..2014-12-31:
|| VHT 294.00 98.00
>=0
# 9. Multicolumn income statement with --row-total, --average, and --summary-only
# ** 9. Multicolumn income statement with --row-total, --average, and --summary-only
$ hledger -f bcexample.hledger is -Y income expenses:food -3 --layout=bare --row-total --average --summary-only
>
Income Statement 2012-01-01..2014-12-31
@ -147,7 +148,7 @@ Income Statement 2012-01-01..2014-12-31
|| VACHR 337.26 112.42
>=0
# 10. Multicolumn budget report csv output with --layout=bare.
# ** 10. Multicolumn budget report csv output with --layout=bare.
$ hledger -f bcexample.hledger bal -Y assets.*etrade -3 -O csv --layout=bare --budget
>
"Account","Commodity","2012","budget","2013","budget","2014","budget"
@ -163,7 +164,7 @@ $ hledger -f bcexample.hledger bal -Y assets.*etrade -3 -O csv --layout=bare --b
"Total:","VHT","106.00","0","18.00","0","170.00","0"
>=0
# 11. Multicolumn balance report with --layout=bare and null commodity
# ** 11. Multicolumn balance report with --layout=bare and null commodity
<
2018/1/1
(a) 1
@ -185,7 +186,7 @@ Balance changes in 2018:
|| EUR 1
# 12. Multicolumn balance report with --layout=bare --transpose.
# ** 12. Multicolumn balance report with --layout=bare --transpose.
$ hledger -f bcexample.hledger bal -Y assets.*etrade -1 --average --layout=bare --transpose
>
Balance changes in 2012-01-01..2014-12-31:
@ -199,7 +200,7 @@ Balance changes in 2012-01-01..2014-12-31:
Average || 23.33 5.67 1706.83 12.00 98.00 | 23.33 5.67 1706.83 12.00 98.00
>=0
# 13. Multicolumn budget report with --layout=bare --transpose.
# ** 13. Multicolumn budget report with --layout=bare --transpose.
<
~ daily from 2016/1/1
expenses:food $10
@ -243,7 +244,7 @@ Budget performance in 2016-12-01..2016-12-03:
Total || -75 [100% of -75] 75 [100% of 75] 30 [100% of 30] 5 [11% of 45]
>=0
# 14. Compound balance report output with --layout=bare.
# ** 14. Compound balance report output with --layout=bare.
$ hledger -f bcexample.hledger bs -3 --layout=bare
>
Balance Sheet 2014-10-11
@ -288,7 +289,7 @@ Balance Sheet 2014-10-11
|| VHT 294.00
>=0
# 15. Multicolumn balance report csv output with --layout=tidy
# ** 15. Multicolumn balance report csv output with --layout=tidy
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=tidy
>
"account","period","start_date","end_date","commodity","value"
@ -309,7 +310,7 @@ $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=tidy
"Assets:US:ETrade","2014","2014-01-01","2014-12-31","VHT","170.00"
>=0
# 16. Single column balance report csv output with --layout=tidy
# ** 16. Single column balance report csv output with --layout=tidy
$ hledger -f bcexample.hledger bal -T assets.*etrade -3 -O csv --layout=tidy
>
"account","period","start_date","end_date","commodity","value"
@ -325,7 +326,7 @@ $ hledger -f bcexample.hledger bal -T assets.*etrade -3 -O csv --layout=tidy
Assets:Bank INR 1.00
Equity:Opening INR -1.00
# 17. Should omit commodity from totals row when the sum is zero with --layout=bare. (#1789)
# ** 17. Should omit commodity from totals row when the sum is zero with --layout=bare. (#1789)
$ hledger -f - bal --layout=bare
1.00 INR Assets:Bank
-1.00 INR Equity:Opening
@ -333,7 +334,7 @@ $ hledger -f - bal --layout=bare
0
>=0
# 18. The same with -M. (#1789)
# ** 18. The same with -M. (#1789)
$ hledger -f - bal --layout=bare -M
Balance changes in 2021-01:

View File

@ -1,3 +1,5 @@
# * balance reports with multiple commodities
<
2020-01-01
(a) 1.00A
@ -10,7 +12,7 @@
(a) 1.00E
(a) 1.00F
# 1. In tabular balance reports, display on a single line by default
# ** 1. In tabular balance reports, display on a single line by default
$ hledger -f- bal -Y
Balance changes in 2020-01-01..2021-12-31:
@ -20,7 +22,7 @@ Balance changes in 2020-01-01..2021-12-31:
---++-------------------------------------------------
|| 1.00A, 1.00B, 1.00C, 1.00D 1.00D, 1.00E, 1.00F
# 2. Display multiline if requested
# ** 2. Display multiline if requested
$ hledger -f- bal -Y --layout=tall
Balance changes in 2020-01-01..2021-12-31:
@ -36,7 +38,7 @@ Balance changes in 2020-01-01..2021-12-31:
|| 1.00C 1.00F
|| 1.00D
# 3. Display a commodity column if requested
# ** 3. Display a commodity column if requested
$ hledger -f- bal -Y --layout=bare
Balance changes in 2020-01-01..2021-12-31:
@ -56,7 +58,7 @@ Balance changes in 2020-01-01..2021-12-31:
|| E 0 1.00
|| F 0 1.00
# 4. Display elided to a specific width if requested
# ** 4. Display elided to a specific width if requested
$ hledger -f- bal -Y --layout=wide,22
Balance changes in 2020-01-01..2021-12-31:
@ -87,7 +89,7 @@ Balance changes in 2020-01-01..2021-12-31:
ea50865f:3bfb86b7:bf72f75a:a7cad1ac C$ -26.00
ea50865f:325566ed:216fec7e:7b433efb C$ 1.44
# 5. Make sure all amounts up to the largest fit when eliding
# ** 5. Make sure all amounts up to the largest fit when eliding
$ hledger -f- bal -Y --color=yes --layout=wide,32
Balance changes in 2020:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env shelltest
# * balance command --no-total and --no-elide flags
#
<
2010/04/01 tr1
@ -9,7 +9,7 @@
a -16$
b 16$
# 1. One commodity. Zero accounts should be elided but the final total should not.
# ** 1. One commodity. Zero accounts should be elided but the final total should not.
$ hledger -f - balance
>
--------------------
@ -20,13 +20,13 @@ $ hledger -f - balance
1/1
(a:b) 1
# 2. An uninteresting parent account (with same balance as its single subaccount) is elided by default, like ledger
# ** 2. An uninteresting parent account (with same balance as its single subaccount) is elided by default, like ledger
$ hledger -f - balance --no-total --tree
>
1 a:b
>=0
# 3. But not with --no-elide
# ** 3. But not with --no-elide
$ hledger -f - balance --no-total --tree --no-elide
>
1 a
@ -38,7 +38,7 @@ $ hledger -f - balance --no-total --tree --no-elide
(a:b) 1
(a:c) -1
# 4. Nor when it has more than one subaccount
# ** 4. Nor when it has more than one subaccount
$ hledger -f - balance --tree --no-total
>
0 a
@ -55,24 +55,24 @@ $ hledger -f - balance --tree --no-total
(a:aa:aaa) 1
(a:aa:aaa) -1
# 5. Zero-balance leaves should also be hidden by default.
# ** 5. Zero-balance leaves should also be hidden by default.
$ hledger -f - balance --tree --no-total
1 a
# 6. Zero-balance leaves should be displayed in tree mode when --empty
# ** 6. Zero-balance leaves should be displayed in tree mode when --empty
# is called, but zero-balance uninteresting parent accounts are elided
# by default.
$ hledger -f - balance --tree --no-total --empty
1 a
0 aa:aaa
# 7. But displayed with --no-elide
# ** 7. But displayed with --no-elide
$ hledger -f - balance --tree --no-total --empty --no-elide
1 a
0 aa
0 aaa
# 8. Same as 5 for multiperiod
# ** 8. Same as 5 for multiperiod
$ hledger -f - balance --tree --no-total -Y
Balance changes in 2020:
@ -80,7 +80,7 @@ Balance changes in 2020:
===++======
a || 1
# 9. Same as 6 for mulitperiod
# ** 9. Same as 6 for mulitperiod
$ hledger -f - balance --tree --no-total -Y --empty
Balance changes in 2020:
@ -89,7 +89,7 @@ Balance changes in 2020:
a || 1
aa:aaa || 0
# 10. Same as 7 for multiperiod
# ** 10. Same as 7 for multiperiod
$ hledger -f - balance --tree --no-total -Y --empty --no-elide
Balance changes in 2020:
@ -99,13 +99,13 @@ Balance changes in 2020:
aa || 0
aaa || 0
# 11. In flat mode, display all zero-balance accounts, including non-leaves
# ** 11. In flat mode, display all zero-balance accounts, including non-leaves
$ hledger -f - balance --flat --no-total --empty
1 a
0 a:aa
0 a:aa:aaa
# 12. Same as 11 for multiperiod
# ** 12. Same as 11 for multiperiod
$ hledger -f - balance --flat --no-total -Y --empty
Balance changes in 2020:

View File

@ -1,5 +1,6 @@
#!/usr/bin/env shelltest
# 1. Single column percent
# * balance command -%/--percent flag
# ** 1. Single column percent
$ hledger -f sample.journal balance expenses -% --tree
100.0 % expenses
50.0 % food
@ -7,7 +8,7 @@ $ hledger -f sample.journal balance expenses -% --tree
--------------------
100.0 %
# 2. Multi column percent
# ** 2. Multi column percent
$ hledger -f sample.journal balance expenses -% -p quarterly
Balance changes in 2008:
@ -18,7 +19,7 @@ Balance changes in 2008:
-------------------++---------------------------------
|| 0 100.0 % 0 0
# 3. In a balanced ledger everything should sum up to zero, therefore all percentages should be zero.
# ** 3. In a balanced ledger everything should sum up to zero, therefore all percentages should be zero.
$ hledger -f sample.journal balance -% -p quarterly
Balance changes in 2008:

View File

@ -1,4 +1,5 @@
# 1. Uses Unicode tables when given --pretty=yes
# * --pretty option and balance command
# ** 1. Uses Unicode tables when given --pretty=yes
$ hledger -f balance-multicol.journal balance --pretty=yes -M
Balance changes in 2012-12-01..2013-03-31:
@ -10,7 +11,7 @@ Balance changes in 2012-12-01..2013-03-31:
─────────────────╫────────────────────────────────────
║ 10 0 2 1
# 2. Uses Unicode tables when given --pretty
# ** 2. Uses Unicode tables when given --pretty
$ hledger -f balance-multicol.journal balance --pretty -M
Balance changes in 2012-12-01..2013-03-31:
@ -22,7 +23,7 @@ Balance changes in 2012-12-01..2013-03-31:
─────────────────╫────────────────────────────────────
║ 10 0 2 1
# 3. Uses ASCII tables when given --pretty=no
# ** 3. Uses ASCII tables when given --pretty=no
$ hledger -f balance-multicol.journal balance --pretty=no -M
Balance changes in 2012-12-01..2013-03-31:
@ -34,7 +35,7 @@ Balance changes in 2012-12-01..2013-03-31:
-----------------++------------------------------------
|| 10 0 2 1
# 4. Still accepts the legacy --pretty-tables for now
# ** 4. Still accepts the legacy --pretty-tables for now
$ hledger -f balance-multicol.journal balance --pretty-tables -M
Balance changes in 2012-12-01..2013-03-31:

View File

@ -1,4 +1,4 @@
# * balance report sorting. -*- eval:(outshine-mode 1); outline-regexp:"# \\*"; -*-
# * balance report sorting
# ** Default sort, without account declarations
@ -15,7 +15,7 @@
2018/1/1
(a:k) 1
# 1. In tree mode, rows are sorted alphabetically by account name, at each tree level.
# ** 1. In tree mode, rows are sorted alphabetically by account name, at each tree level.
# Missing parent accounts are added (b).
$ hledger -f- bal -N --tree
1 a:k
@ -24,7 +24,7 @@ $ hledger -f- bal -N --tree
1 j
1 c
# 2. In flat mode, unused parent accounts are not added (b).
# ** 2. In flat mode, unused parent accounts are not added (b).
$ hledger -f- bal -N --flat
1 a:k
1 b:i
@ -56,7 +56,7 @@ account d
2018/1/1
(d) 1
# 3. With account directives, in tree mode, at each tree level
# ** 3. With account directives, in tree mode, at each tree level
# declared accounts are sorted first in declaration order,
# followed by undeclared accounts sorted alphabetically.
# Missing parent accounts are added (b).
@ -70,7 +70,7 @@ $ hledger -f- bal -N --tree
1 i
1 c
# 4. In flat mode, unused parent accounts are not added (b).
# ** 4. In flat mode, unused parent accounts are not added (b).
$ hledger -f- bal -N --flat
1 d
1 a:l
@ -81,7 +81,7 @@ $ hledger -f- bal -N --flat
# ** Sort by amount
# 5. In flat mode with -S, largest (most-positive) amounts are shown first:
# ** 5. In flat mode with -S, largest (most-positive) amounts are shown first:
<
2018/1/1
(b:j) 2
@ -101,7 +101,7 @@ $ hledger -f- bal -N -S --flat
1 b:i
1 c
# 6. In tree mode with -S, rows are sorted by largest amount, and then by account name, at each tree level.
# ** 6. In tree mode with -S, rows are sorted by largest amount, and then by account name, at each tree level.
$ hledger -f- bal -N -S --tree
3 b
2 j
@ -109,7 +109,7 @@ $ hledger -f- bal -N -S --tree
1 a:k
1 c
# 7. In hledger 1.4-1.10, when the larger amount was composed of differently-priced amounts,
# ** 7. In hledger 1.4-1.10, when the larger amount was composed of differently-priced amounts,
# it could get sorted as if smaller. Should work now. Test tree mode.
<
2018/1/1
@ -123,12 +123,12 @@ $ hledger -f- bal -N -S --tree
4X a
3X b
# 8. Same in flat mode.
# ** 8. Same in flat mode.
$ hledger -f- bal -N -S --flat
4X a
3X b
# 9. #1279 in hledger 1.11-1.18, bal -S did not respect the hierarchy. Should work now:
# ** 9. #1279 in hledger 1.11-1.18, bal -S did not respect the hierarchy. Should work now:
<
2020-01-01
(a:aa) 1
@ -141,19 +141,19 @@ $ hledger -f- bal -N -S --tree
1 aa
2 b
# 10. #1287 bal -S -H did not sort by amount, should work now:
# ** 10. #1287 bal -S -H did not sort by amount, should work now:
$ hledger -f- bal -N -S -H --flat
3 a:ab
2 b
1 a:aa
# 11. #1287 and bal -S --cumulative:
# ** 11. #1287 and bal -S --cumulative:
$ hledger -f- bal -N -S --cumulative --flat
3 a:ab
2 b
1 a:aa
# 12. #1283 most-negative amounts are sorted last, so eg largest revenues/liabilities are last:
# ** 12. #1283 most-negative amounts are sorted last, so eg largest revenues/liabilities are last:
<
2020-01-01
(revenues:a) -1
@ -165,13 +165,13 @@ $ hledger -f- bal -N -S
-2 revenues:c
-3 revenues:b
# 13. This can be worked around by using --invert (sorting happens after sign-flipping):
# ** 13. This can be worked around by using --invert (sorting happens after sign-flipping):
$ hledger -f- bal -N -S --invert
3 revenues:b
2 revenues:c
1 revenues:a
# 14. Or a sign-flipping command like incomestatement:
# ** 14. Or a sign-flipping command like incomestatement:
$ hledger -f- is -N -S
Income Statement 2020-01-01
@ -206,7 +206,7 @@ Income Statement 2020-01-01
2021-01-01 Post in X
(a) -1 X
# 15. When sorting by amount with different commodities, missing commodities are
# ** 15. When sorting by amount with different commodities, missing commodities are
# treated as 0, so negative amounts go before positive amounts. (#1563)
#
# Explanation: We treats these amounts as

View File

@ -1,4 +1,5 @@
# 1. A trivial balance sheet. With no accounts of type Asset declared,
# * balancesheet command
# ** 1. A trivial balance sheet. With no accounts of type Asset declared,
# a top-level "assets" account is autodetected as an Asset.
<
2016/1/1
@ -22,7 +23,7 @@ Balance Sheet 2016-01-01
=============++============
Net: || 1
# 2. Account type autodetection is case insensitive.
# ** 2. Account type autodetection is case insensitive.
<
2016/1/1
ASSETS 1
@ -45,7 +46,7 @@ Balance Sheet 2016-01-01
=============++============
Net: || 1
# 3. monthly balance sheet, normal positive sign
# ** 3. monthly balance sheet, normal positive sign
# old (arithmetic sign):
#Balance Sheet
#
@ -88,7 +89,7 @@ Balance Sheet 2008-01-31..2008-12-31
======================++================================================================================================================================================
Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
# 4. monthly balance sheet in tree mode
# ** 4. monthly balance sheet in tree mode
# old (arithmetic sign):
# || 2008/01/31 2008/02/29 2008/03/31 2008/04/30 2008/05/31 2008/06/30 2008/07/31 2008/08/31 2008/09/30 2008/10/31 2008/11/30 2008/12/31
#==============++================================================================================================================================================
@ -134,7 +135,7 @@ Balance Sheet 2008-01-31..2008-12-31
===================++================================================================================================================================================
Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
# 5. monthly balancesheet with average column and without overall totals row.
# ** 5. monthly balancesheet with average column and without overall totals row.
# Total column is requested but not shown because balancesheet is in historical mode
# by default (shows ending balances).
$ hledger -f sample.journal balancesheet -p 'monthly in 2008' -NAT
@ -152,7 +153,7 @@ Balance Sheet 2008-01-31..2008-12-31
----------------------++---------------------------------------------------------------------------------------------------------------------------------------------------------
liabilities:debts || 0 0 0 0 0 0 0 0 0 0 0 $-1 0
# 6. Tree output still works, #565
# ** 6. Tree output still works, #565
<
2017/1/1
(assets:b) 1
@ -174,7 +175,7 @@ Balance Sheet 2017-01-01
=============++============
Net: || 1
# 7. Flat output still works, #552
# ** 7. Flat output still works, #552
<
2017/1/1
(assets:b) 1
@ -196,7 +197,7 @@ Balance Sheet 2017-01-01
=============++============
Net: || 1
# 8. An empty section does not disrupt the overall totals, #588
# ** 8. An empty section does not disrupt the overall totals, #588
<
2017/1/1
(assets) $1
@ -218,7 +219,7 @@ Balance Sheet 2017-12-31
=============++=====================
Net: || $1 $1
# 9. --pretty=yes uses unicode chars for borders
# ** 9. --pretty=yes uses unicode chars for borders
<
2016/1/1
assets 1
@ -241,7 +242,7 @@ Balance Sheet 2016-01-31
═════════════╬════════════
Net: ║ 1
# 10. Check that accounts brought to zero by subaccount balances
# ** 10. Check that accounts brought to zero by subaccount balances
# are not erased from balancesheet
<
2018-10-01
@ -279,7 +280,7 @@ Balance Sheet 2018-10-03
=====================================++============
Net: || $120
# 11. Check that starting balances are also filtered by subreport query. (See issue #1335)
# ** 11. Check that starting balances are also filtered by subreport query. (See issue #1335)
<
2020-03-01 * Rent
assets:a -$1
@ -306,7 +307,7 @@ Balance Sheet 2020-03-25
=============++============
Net: || $1
# 12. CSV output. It always shows full account names, even in tree mode (#1566).
# ** 12. CSV output. It always shows full account names, even in tree mode (#1566).
$ hledger -f - balancesheet --tree --output-format=csv
"Balance Sheet 2020-03-25",""
"Account","2020-03-25"
@ -317,7 +318,7 @@ $ hledger -f - balancesheet --tree --output-format=csv
"total"
"Net:","$1"
# 13. CSV output supports --drop.
# ** 13. CSV output supports --drop.
$ hledger -f - balancesheet --tree --output-format=csv --drop 1
"Balance Sheet 2020-03-25",""
"Account","2020-03-25"
@ -333,7 +334,7 @@ $ hledger -f - balancesheet --tree --output-format=csv --drop 1
assets:a -$10 000.00
expenses
# 14. CSV output drops thousands separators
# ** 14. CSV output drops thousands separators
$ hledger -f - balancesheet --output-format=csv
"Balance Sheet 2020-03-01",""
"Account","2020-03-01"
@ -344,7 +345,7 @@ $ hledger -f - balancesheet --output-format=csv
"total"
"Net:","$-10000.00"
# 15. In compound reports like balancesheet, parent accounts might not have
# ** 15. In compound reports like balancesheet, parent accounts might not have
# the appropriate type for a subreport, but in tree reports they should be
# displayed anyway, and with the right inclusive amounts and starting
# balances. (#1698)

View File

@ -1,4 +1,5 @@
# 1.
# * cashflow command
# ** 1.
<
2016/1/1
assets:cash 1
@ -37,7 +38,7 @@ Cashflow Statement 2016-01-01
assets:bank:checking $10.00
assets:receivables -$10.00
# 2. Period reporting works for a specific year
# ** 2. Period reporting works for a specific year
$ hledger -f - cashflow -b 2016 -e 2017
Cashflow Statement 2016
@ -51,7 +52,7 @@ Cashflow Statement 2016
>2
>= 0
# 3. Period reporting works for two years
# ** 3. Period reporting works for two years
$ hledger -f - cashflow -b 2015 -e 2017
Cashflow Statement 2015-01-01..2016-12-31
@ -65,7 +66,7 @@ Cashflow Statement 2015-01-01..2016-12-31
>2
>= 0
# 4. Period reporting works for one month
# ** 4. Period reporting works for one month
$ hledger -f - cashflow -b 2015/11 -e 2015/12
Cashflow Statement 2015-11
@ -79,7 +80,7 @@ Cashflow Statement 2015-11
>2
>= 0
# 5. Period reporting works for one month in another year
# ** 5. Period reporting works for one month in another year
$ hledger -f - cashflow -b 2016/10 -e 2016/11
Cashflow Statement 2016-10
@ -92,7 +93,7 @@ Cashflow Statement 2016-10
>2
>= 0
# 6. Multicolumn test
# ** 6. Multicolumn test
$ hledger -f sample.journal cashflow -p 'monthly in 2008'
Cashflow Statement 2008
@ -107,7 +108,7 @@ Cashflow Statement 2008
|| $1 0 0 0 0 $-1 0 0 0 0 0 $-1
>= 0
# 7. Multicolumn test (historical)
# ** 7. Multicolumn test (historical)
$ hledger -f sample.journal cashflow -p 'monthly in 2008' -A --historical
Cashflow Statement 2008-01-31..2008-12-31 (Historical Ending Balances)
@ -122,7 +123,7 @@ Cashflow Statement 2008-01-31..2008-12-31 (Historical Ending Balances)
|| $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1 0
>= 0
# 8. without -N/--no-total
# ** 8. without -N/--no-total
$ hledger -f sample.journal cf
Cashflow Statement 2008
@ -137,7 +138,7 @@ Cashflow Statement 2008
>2
>= 0
# 9. with -N
# ** 9. with -N
$ hledger -f sample.journal cf -N
Cashflow Statement 2008
@ -150,7 +151,7 @@ Cashflow Statement 2008
>2
>= 0
# 10. exclude fixed assets from cashflow
# ** 10. exclude fixed assets from cashflow
<
2016/1/1
assets:cash 1

View File

@ -1,11 +1,12 @@
# 1. check accounts succeeds when all accounts are declared
# * check accounts
# ** 1. check accounts succeeds when all accounts are declared
<
account a
2020-01-01
(a) 1
$ hledger -f- check accounts
# 2. and otherwise fails:
# ** 2. and otherwise fails:
<
2020-01-01
(a) 1
@ -13,7 +14,7 @@ $ hledger -f- check accounts
>2 /account "a" has not been declared/
>=1
# 3. also fails for forecast accounts
# ** 3. also fails for forecast accounts
<
account a
~ 2022-01-31
@ -23,12 +24,12 @@ $ hledger -f- --today 2022-01-01 --forecast check accounts
>2 /account "b" has not been declared/
>=1
# 4. also fails in --strict mode
# ** 4. also fails in --strict mode
$ hledger -f- --today 2022-01-01 --forecast --strict bal
>2 /account "b" has not been declared/
>=1
# 5. also fails for auto accounts
# ** 5. also fails for auto accounts
<
account a
@ -43,7 +44,7 @@ $ hledger -f- --auto check accounts
>2 /account "b" has not been declared/
>=1
# 6. also fails in --strict mode
# ** 6. also fails in --strict mode
$ hledger -f- --auto --strict bal
>2 /account "b" has not been declared/
>=1

View File

@ -1,4 +1,5 @@
# 1. Check that prices balance without auto-inferring prices
# * check balanced
# ** 1. Check that prices balance without auto-inferring prices
<
2011/01/01 x
a -10£

View File

@ -1,11 +1,12 @@
# 1. check commodities succeeds when all commodities are declared
# * check commodities
# ** 1. check commodities succeeds when all commodities are declared
<
commodity $1.
2020-01-01
(a) $1
$ hledger -f- check commodities
# 2. and otherwise fails
# ** 2. and otherwise fails
<
2020-01-01
(a) $1
@ -13,7 +14,7 @@ $ hledger -f- check commodities
>2 /commodity "\$" has not been declared/
>=1
# 3. But commodityless zero amounts will not fail
# ** 3. But commodityless zero amounts will not fail
<
2020-01-01
(a) 0
@ -21,7 +22,7 @@ $ hledger -f- check commodities
$ hledger -f- check commodities
>=0
# 4. But zero amounts with undeclared commodities still fail
# ** 4. But zero amounts with undeclared commodities still fail
<
2020-01-01
(a) $0

View File

@ -1,10 +1,11 @@
# 1. tags can be declared
# * check tags
# ** 1. tags can be declared
<
tag atag ; this is atag. tags: on tags are not allowed and will be ignored.
indented subdirectives are ignored.
$ hledger -f - check
# 2. check tags succeeds when all tags are declared
# ** 2. check tags succeeds when all tags are declared
<
tag atag
tag ttag
@ -17,21 +18,21 @@ account a ; atag:
$ hledger -f - check tags
# 3. it detects an undeclared account tag
# ** 3. it detects an undeclared account tag
<
account a ; atag:
$ hledger -f - check tags
>2 /tag "atag" has not been declared/
>=1
# 4. it detects an undeclared transaction tag
# ** 4. it detects an undeclared transaction tag
<
2023-01-01 ; ttag:
$ hledger -f - check tags
>2 /tag "ttag" has not been declared/
>=1
# 5. it detects an undeclared posting tag
# ** 5. it detects an undeclared posting tag
<
2023-01-01
(a) 0 ; ptag:

View File

@ -1,4 +1,4 @@
# hledger command line processing
# * command line interface
#
# Quick guide to terms used here:
#
@ -59,61 +59,61 @@
# version
# 1. --version shows version
# ** 1. --version shows version
$ hledger --version
> /^hledger [0-9]/
# 2. --version also works after a command, if it's internal
# ** 2. --version also works after a command, if it's internal
$ hledger balance --version
> /^hledger [0-9]/
# help
# 3. with no command, show commands list
# ** 3. with no command, show commands list
$ hledger
> /^Commands/
# 4. no-command help still works if there are flags, at least the common ones
# ** 4. no-command help still works if there are flags, at least the common ones
$ hledger -fsomefile
> /^Commands/
# 5. and also with a space between flag and value
# ** 5. and also with a space between flag and value
$ hledger -f somefile
> /^Commands/
# 6. with -h, and possibly other common flags present, show general usage
# ** 6. with -h, and possibly other common flags present, show general usage
$ hledger -h --version -f /dev/null
> /^hledger \[CMD\]/
# 7. with -h before a COMMAND, show command usage
# ** 7. with -h before a COMMAND, show command usage
$ hledger -h balance --cost
> /balance \[OPTIONS\]/
# 8. with -h after a command, show command usage
# ** 8. with -h after a command, show command usage
$ hledger balance -h
> /balance \[OPTIONS\]/
# 9. with an unrecognised command, give an error and non-zero exit status
# ** 9. with an unrecognised command, give an error and non-zero exit status
$ hledger nosuchcommand
>2 /not recognized.*to see a list/
>= 1
# flag positions
# 10. general flags can go before command
# ** 10. general flags can go before command
$ hledger -f /dev/null --alias somealiases --rules-file --debug 1 --daily register
# 11. or after it, and spaces in options are optional
# ** 11. or after it, and spaces in options are optional
$ hledger register -f/dev/null --alias=somealiases --rules-file -h --version --debug 1 --daily
> /^register \[OPTIONS\]/
# 12. general flags before command should work
# ** 12. general flags before command should work
$ hledger -f /dev/null --daily register
# 13. command-specific flags can go after command
# ** 13. command-specific flags can go after command
$ hledger -f /dev/null register --daily
# 14. but not before it
# ** 14. but not before it
$ hledger --related register
>2 /Unknown flag: --related/
>= 1

View File

@ -1,4 +1,6 @@
# 1. Test whether only the style without a symbol is changed
# * commodity styles
# ** 1. Test whether only the style without a symbol is changed
<
2021-07-09 no symbol
(a) 1234
@ -21,7 +23,7 @@ $ hledger -f- print -c '10 00'
>=
# 2. Test whether setting the style of multiple symbols work
# ** 2. Test whether setting the style of multiple symbols work
<
2021-07-09 Euro
(a) EUR 1,234.56
@ -38,7 +40,7 @@ $ hledger -f- print -c 'EUR 1.000,00' -c '$ 1,000.00'
>=
# 3. When setting the same symbol multiple times, the last one is in effect
# ** 3. When setting the same symbol multiple times, the last one is in effect
<
2021-07-09 Euro
(a) EUR 1234
@ -49,7 +51,7 @@ $ hledger -f- print -c 'EUR 1.000,00' -c 'EUR 1,000.00'
>=
# 4. Commodity styles are applied to quantity and price of a commodity (except for precision)
# ** 4. Commodity styles are applied to quantity and price of a commodity (except for precision)
<
2021-09-12 buy A
(a) 1,234 A @ 1234,56 $

View File

@ -1,4 +1,6 @@
# 1. all data files on the command line should be read
# * multiple input files
# ** 1. all data files on the command line should be read
hledger is -f personal.journal -f business.journal
>>>
Income Statement 2014-01-01..2014-01-02
@ -21,7 +23,7 @@ Income Statement 2014-01-01..2014-01-02
>>>2
>>>=0
# 2. aliases etc. in files currently don't carry over to subsequent files
# ** 2. aliases etc. in files currently don't carry over to subsequent files
hledger print -f personal.journal -f business.journal -f alias.journal -f personal.journal
>>>
2014-01-01
@ -43,7 +45,7 @@ hledger print -f personal.journal -f business.journal -f alias.journal -f person
# assets:personal:cash $-1
# 3. files can be of different formats
# ** 3. files can be of different formats
hledger print -f personal.journal -f ../journal/a.timeclock -f ../journal/b.timedot
>>>
2014-01-02
@ -59,7 +61,7 @@ hledger print -f personal.journal -f ../journal/a.timeclock -f ../journal/b.time
>>>2
>>>=0
# 4. same-date transactions in different files are shown in the right order
# ** 4. same-date transactions in different files are shown in the right order
hledger -f a.j -f b.j reg
>>>
2018-01-01 a1 (a) 1 1

View File

@ -1,4 +1,6 @@
# 1. account pattern with space
# * query arguments
# ** 1. account pattern with space
<
2010/3/1 x
a a 1
@ -14,7 +16,7 @@ $ hledger -f- register 'a a'
>=0
#
# 2. description pattern with space
# ** 2. description pattern with space
<
2010/3/1 x
a 1
@ -31,7 +33,7 @@ $ hledger -f- register desc:'x x'
>=0
#
# 3. multiple patterns, spaced and punctuated patterns
# ** 3. multiple patterns, spaced and punctuated patterns
<
2011/9/11
a a 1
@ -44,7 +46,7 @@ $ hledger -f- register 'a a' "'b"
>=0
#
# 4. patterns with quotation marks in them
# ** 4. patterns with quotation marks in them
<
2020-09-19 Quoting
assets:bank -5

View File

@ -1,3 +1,4 @@
# * report intervals, register command
# Input for the following tests:
@ -7,27 +8,24 @@
2019-02-01
(a) 1
# 1. The last report interval option takes precedence.
# ** 1. The last report interval option takes precedence.
$ hledger -f- register --weekly --monthly
2019-01 a 2 2
2019-02 a 1 3
# 2.
# ** 2.
$ hledger -f- register --monthly --weekly
2018-12-31W01 a 2 2
2019-01-28W05 a 1 3
# 3. The last report interval option (--weekly) takes precedence,
# ** 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.
# ** 4.
$ hledger -f- register --weekly -p 'monthly in 2019'
2019-01 a 2 2
2019-02 a 1 3
@ -39,17 +37,17 @@ $ hledger -f- register --weekly -p 'monthly in 2019'
# --monthly -p2019
# -p2019 --monthly
# -p 'monthly in 2019'
# 5.
# ** 5.
$ hledger -f- register --monthly -p 2019
2019-01 a 2 2
2019-02 a 1 3
# 6.
# ** 6.
$ hledger -f- register -p 2019 --monthly
2019-01 a 2 2
2019-02 a 1 3
# 7.
# ** 7.
$ hledger -f- register -p 'monthly in 2019'
2019-01 a 2 2
2019-02 a 1 3

View File

@ -1,3 +1,4 @@
# * close command
<
2016/1/1 open
@ -17,7 +18,7 @@
liabilities $25
assets:cash
# 1. By default, closes ALE accounts, on the last day of the report period.
# ** 1. By default, closes ALE accounts, on the last day of the report period.
$ hledger close -f- -e 2017
2016-12-31 closing balances
assets:bank $-80 = $0
@ -28,7 +29,7 @@ $ hledger close -f- -e 2017
>=0
# 2. With --close, likewise.
# ** 2. With --close, likewise.
$ hledger close -f- -e 2017 --close
2016-12-31 closing balances
assets:bank $-80 = $0
@ -39,7 +40,7 @@ $ hledger close -f- -e 2017 --close
>=0
# 3. With --retain, closes RX accounts.
# ** 3. With --retain, closes RX accounts.
$ hledger close -f- -e 2017 --retain
2016-12-31 retain earnings
expenses:sweets $-5 = $0
@ -47,7 +48,7 @@ $ hledger close -f- -e 2017 --retain
>=0
# 4. With --migrate, opens and closes ALE.
# ** 4. With --migrate, opens and closes ALE.
$ hledger close -f- -p 2016 --migrate
2016-12-31 closing balances
assets:bank $-80 = $0
@ -65,7 +66,7 @@ $ hledger close -f- -p 2016 --migrate
>=0
# 5. With --open, opens ALE.
# ** 5. With --open, opens ALE.
$ hledger close -f- -p 2016 --open
2017-01-01 opening balances
assets:bank $80 = $80
@ -76,7 +77,7 @@ $ hledger close -f- -p 2016 --open
>=0
# 6. -x makes all amounts explicit.
# ** 6. -x makes all amounts explicit.
$ hledger close -f- -p 2016 -x
2016-12-31 closing balances
assets:bank $-80 = $0
@ -87,7 +88,7 @@ $ hledger close -f- -p 2016 -x
>=0
# 7. Closing a multi-priced balance. By default the transaction prices are ignored.
# ** 7. Closing a multi-priced balance. By default the transaction prices are ignored.
<
2019/01/01
assets 1A @ 1B
@ -101,7 +102,7 @@ $ hledger -f- close assets -p 2019 -x
>=0
# 8. With --show-costs, the transaction prices are preserved.
# ** 8. With --show-costs, the transaction prices are preserved.
# Only the last posting in each commodity gets a balance assertion (#1035).
# Balance assertion amounts do not have a price.
$ hledger -f- close assets -p 2019 --show-costs -x
@ -113,7 +114,7 @@ $ hledger -f- close assets -p 2019 --show-costs -x
>=0
# 9. Closing a multi-priced balance, slightly more complex
# ** 9. Closing a multi-priced balance, slightly more complex
# (different price in each transaction).
# XXX account parentheses should be preserved here
<
@ -130,7 +131,7 @@ $ hledger -f- close assets -p 2019 -x
>=0
# 10. The same with costs preserved.
# ** 10. The same with costs preserved.
$ hledger -f- close assets -p 2019 --show-costs -x
2019-12-31 closing balances
assets -1A @ 1B
@ -140,7 +141,7 @@ $ hledger -f- close assets -p 2019 --show-costs -x
>=0
# 11. Closing a multi-priced balance, a more complex example.
# ** 11. Closing a multi-priced balance, a more complex example.
# Decimal places specified by the amount display style should not be stripped
# even if they are zeros (#1137).
<
@ -178,7 +179,7 @@ $ hledger -f- close -p 2016 assets liabilities --show-costs -x
>=0
# 12. With --interleaved, each transfer's postings are adjacent.
# ** 12. With --interleaved, each transfer's postings are adjacent.
# (And balances with the same cost are not necessarily combined into
# a single posting. Eg the 5734 EUR above is 5733 EUR and 1 EUR below.)
$ hledger -f- close -p 2016 assets liabilities --interleaved --show-costs -x
@ -196,7 +197,7 @@ $ hledger -f- close -p 2016 assets liabilities --interleaved --show-costs -x
>=0
# 13. A tricky case where a closing posting was rounded and failed to balance (#1164)
# ** 13. A tricky case where a closing posting was rounded and failed to balance (#1164)
<
commodity $0.00
commodity AAA 0.00000000
@ -221,7 +222,7 @@ $ hledger -f- close -p 2019 assets --show-costs -x
>=0
# 14. The same, without costs and with --interleaved.
# ** 14. The same, without costs and with --interleaved.
$ hledger -f- close -p 2019 assets --interleaved -x
2019-12-31 closing balances
assets:aaa AAA -510 = AAA 0
@ -231,7 +232,7 @@ $ hledger -f- close -p 2019 assets --interleaved -x
>=0
# 15. "The default closing date is yesterday, or the journal's end date, whichever is later."
# ** 15. "The default closing date is yesterday, or the journal's end date, whichever is later."
<
999999-12-31
(a) 1
@ -239,7 +240,7 @@ $ hledger -f- close
> /999999-12-31 closing balances/
>=
# 15. "override the closing date ... by specifying a report period, where last day of the report period will be the closing date"
# ** 15. "override the closing date ... by specifying a report period, where last day of the report period will be the closing date"
$ hledger -f- close -e 100000-01-01
> /99999-12-31 closing balances/
>=

View File

@ -1,4 +1,4 @@
# codes command
# * codes command
<
1/1 (123)
@ -19,14 +19,14 @@
1/1
(a) 1
# 1. Show non-empty codes by default, in parse order, including duplicates.
# ** 1. Show non-empty codes by default, in parse order, including duplicates.
$ hledger -f - codes
123
124
123
>=
# 2. With -E, also show empty/missing codes as blank lines.
# ** 2. With -E, also show empty/missing codes as blank lines.
$ hledger -f - codes -E
123

View File

@ -1,4 +1,5 @@
# 1. read CSV to hledger journal format
# * CSV input
# ** 1. read CSV to hledger journal format
<
10/2009/09,Flubber Co,50
RULES
@ -14,7 +15,7 @@ $ ./csvtest.sh
>=0
# 2. reading CSV with in-field and out-field
# ** 2. reading CSV with in-field and out-field
<
10/2009/09,Flubber Co🎅,50,
11/2009/09,Flubber Co🎅,,50
@ -38,7 +39,7 @@ $ ./csvtest.sh
>=0
# 3. handle conditions assigning multiple fields
# ** 3. handle conditions assigning multiple fields
<
10/2009/09,Flubber Co,50
@ -57,7 +58,7 @@ $ ./csvtest.sh
>=0
# 4. read CSV with balance field
# ** 4. read CSV with balance field
<
10/2009/09,Flubber Co,50,123
@ -74,7 +75,7 @@ $ ./csvtest.sh
>=0
# 5. read CSV with empty balance field
# ** 5. read CSV with empty balance field
<
10/2009/09,Flubber Co,50,123
11/2009/09,Blubber Co,60,
@ -96,7 +97,7 @@ $ ./csvtest.sh
>=0
# 6. read CSV with only whitespace in balance field
# ** 6. read CSV with only whitespace in balance field
<
10/2009/09,Flubber Co,50,123
11/2009/09,Blubber Co,60,
@ -118,7 +119,7 @@ $ ./csvtest.sh
>=0
# 7. read CSV with rule double-negating column
# ** 7. read CSV with rule double-negating column
<
date,payee,amount
2009/10/9,Flubber Co,50
@ -145,7 +146,7 @@ $ ./csvtest.sh
>=0
# 8. reading with custom separator: SSV (semicolon-separated)
# ** 8. reading with custom separator: SSV (semicolon-separated)
<
10/2009/09;Flubber Co🎅;50;
11/2009/09;Flubber Co🎅;;50
@ -170,7 +171,7 @@ $ ./csvtest.sh
>=0
# 9. read CSV with balance2 field
# ** 9. read CSV with balance2 field
<
10/2009/09,Flubber Co,50,123
@ -187,7 +188,7 @@ $ ./csvtest.sh
>=0
# 10. read CSV with balance1 and balance2 fields
# ** 10. read CSV with balance1 and balance2 fields
<
10/2009/09,Flubber Co,50,321,123
@ -205,7 +206,7 @@ $ ./csvtest.sh
>=0
# 11. More than two postings
# ** 11. More than two postings
<
10/2009/09,Flubber Co,50,321,123,0.234,VAT
@ -226,7 +227,7 @@ $ ./csvtest.sh
>=0
# 12. More than two postings and different currencies
# ** 12. More than two postings and different currencies
<
10/2009/09,Flubber Co,50,321,123,£,0.234,VAT
@ -247,7 +248,7 @@ $ ./csvtest.sh
>=0
# 13. reading CSV with in-field and out-field, where one could be zero
# ** 13. reading CSV with in-field and out-field, where one could be zero
<
10/2009/09,Flubber Co🎅,50,0
11/2009/09,Flubber Co🎅,0.00,50
@ -271,7 +272,7 @@ $ ./csvtest.sh
>=0
# 14. multiline descriptions
# ** 14. multiline descriptions
<
10/2009/09,"Flubber Co
@ -297,7 +298,7 @@ $ ./csvtest.sh
>=0
# 15. recursive interpolation
# ** 15. recursive interpolation
<
myacct,10/2009/09,Flubber Co,50,
@ -316,7 +317,7 @@ $ ./csvtest.sh
>=0
# 16. Real life-ish paypal parsing example
# ** 16. Real life-ish paypal parsing example
<
"12/22/2018","06:22:50","PST","Someone","Subscription Payment","Completed","USD","10.00","-0.59","9.41","someone@some.where","simon@joyful.com","123456789","Joyful Systems","","9KCXINCOME:UNKNOWNZXXAX","","57.60",""
@ -341,7 +342,7 @@ $ ./csvtest.sh
>=0
# 17. Show that #415 is fixed
# ** 17. Show that #415 is fixed
<
"2016/01/01","$1"
"2016/02/02","$1,000.00"
@ -355,7 +356,7 @@ $ ./csvtest.sh | hledger balance -f - --no-total
$1,001.00 unknown
>=0
# 18. Conditional skips
# ** 18. Conditional skips
<
HEADER
10/2009/09,Flubber Co,50
@ -393,7 +394,7 @@ $ ./csvtest.sh
>=0
# 19. Lines with just balance, no amount (#1000)
# ** 19. Lines with just balance, no amount (#1000)
<
2018-10-15,100
2018-10-16,200
@ -421,7 +422,7 @@ $ ./csvtest.sh
>=0
# 20. Test for #1001 - empty assignment to amount show not eat next line
# ** 20. Test for #1001 - empty assignment to amount show not eat next line
<
2018-10-15,1
@ -435,7 +436,7 @@ $ ./csvtest.sh
>=0
# 21. Amountless postings and conditional third posting
# ** 21. Amountless postings and conditional third posting
<
"12/22/2018","06:22:50","PST","Someone","Subscription Payment","Completed","USD","10.00","-0.59","9.41","someone@some.where","simon@joyful.com","123456789","Joyful Systems","","9KCXINCOME:UNKNOWNZXXAX","","57.60",""
"12/22/2018","06:22:50","PST","Someone","Empty fee","Completed","USD","10.00","","6.66","someone@some.where","simon@joyful.com","987654321","Joyful Systems","","9KCXINCOME:UNKNOWNZXXAX","","99.60",""
@ -476,7 +477,7 @@ $ ./csvtest.sh
>=0
# 22. read CSV with balance-type directive
# ** 22. read CSV with balance-type directive
<
10/2009/09,Flubber Co,50,123
@ -494,7 +495,7 @@ $ ./csvtest.sh
>=0
# 23. create unbalanced virtual posting
# ** 23. create unbalanced virtual posting
<
10/2009/09,Flubber Co,50,123
@ -510,7 +511,7 @@ $ ./csvtest.sh
>=0
# 24. create balanced virtual posting
# ** 24. create balanced virtual posting
<
10/2009/09,Flubber Co,50,-50
@ -528,7 +529,7 @@ $ ./csvtest.sh
>=0
# 25. specify reserved word whitespace separator in rules
# ** 25. specify reserved word whitespace separator in rules
<
2009/10/01 Flubber Co 50 123
@ -544,7 +545,7 @@ $ ./csvtest.sh
>=0
# 26. manually setting hledger's default "expenses:unknown"/"income:unknown" names works (#1192)
# ** 26. manually setting hledger's default "expenses:unknown"/"income:unknown" names works (#1192)
<
2020-01-01,5
@ -560,7 +561,7 @@ $ ./csvtest.sh
>=0
# 27. match a specific field
# ** 27. match a specific field
<
2020-01-01, 1
2020-01-01, 2
@ -574,7 +575,7 @@ $ ./csvtest.sh desc:one
>=0
# 28. choose unknown account names correctly when no account name is set
# ** 28. choose unknown account names correctly when no account name is set
# and backwards-compatibly generating two postings.
<
2020-01-01, 1,
@ -587,7 +588,7 @@ $ ./csvtest.sh
>=0
# 29. choose unknown account name correctly when only account1 is set
# ** 29. choose unknown account name correctly when only account1 is set
# and backwards-compatibly generating second posting.
<
2020-01-01, 1, a
@ -600,7 +601,7 @@ $ ./csvtest.sh
>=0
# 30. leave unknown account name as-is when explicitly set by user (#1192).
# ** 30. leave unknown account name as-is when explicitly set by user (#1192).
<
2020-01-01, 1, a
RULES
@ -613,7 +614,7 @@ $ ./csvtest.sh
>=0
# 31. Can generate a transaction with amount on the first posting only.
# ** 31. Can generate a transaction with amount on the first posting only.
<
2020-01-01, 1
RULES
@ -626,7 +627,7 @@ $ ./csvtest.sh
>=0
# 32. Can generate a transaction with an amount on the second posting only.
# ** 32. Can generate a transaction with an amount on the second posting only.
<
2020-01-01, 1
RULES
@ -639,7 +640,7 @@ $ ./csvtest.sh
>=0
# 33. The unnumbered amount rule converts posting 2's amount to cost.
# ** 33. The unnumbered amount rule converts posting 2's amount to cost.
<
2020-01-01, 1
RULES
@ -652,7 +653,7 @@ $ ./csvtest.sh
>=0
# 34. For a given posting, any numbered amount rule disables all unnumbered amount rules.
# ** 34. For a given posting, any numbered amount rule disables all unnumbered amount rules.
# Here, amount-out is used for posting 1, but ignored for posting 2. (#1226)
<
2020-01-01,1,1
@ -665,7 +666,7 @@ $ ./csvtest.sh
>=0
# 35. tabular rules assigning multiple fields
# ** 35. tabular rules assigning multiple fields
<
10/2009/09,Flubber Co,50
@ -683,7 +684,7 @@ $ ./csvtest.sh
>=0
# 36. tabular rules assigning multiple fields followed by regular rules
# ** 36. tabular rules assigning multiple fields followed by regular rules
<
10/2009/09,Flubber Co,50
10/2009/09,Blubber Co,150
@ -711,7 +712,7 @@ $ ./csvtest.sh
>=0
# 37. tabular rules with empty values
# ** 37. tabular rules with empty values
<
10/2009/09,Flubber Co,50
10/2009/09,Blubber Co,150
@ -735,7 +736,7 @@ $ ./csvtest.sh
>=0
# 38. tabular rules with field matchers and '|' separator
# ** 38. tabular rules with field matchers and '|' separator
<
10/2009/09,Flubber Co,50
10/2009/09,Blubber Co,150
@ -759,7 +760,7 @@ $ ./csvtest.sh
>=0
# 39. Insufficient number of values in tabular rules error
# ** 39. Insufficient number of values in tabular rules error
<
10/2009/09,Flubber Co,50
10/2009/09,Blubber Co,150
@ -782,7 +783,7 @@ line of conditional table should have 2 values, but this one has only 1
>=1
# 40. unindented condition block error
# ** 40. unindented condition block error
<
10/2009/09,Flubber Co,50
@ -805,7 +806,7 @@ start of conditional block found, but no assignment rules afterward
>=1
# 41. Assignment to custom field (#1264) + spaces after the if (#1120)
# ** 41. Assignment to custom field (#1264) + spaces after the if (#1120)
<
10/2009/09,Flubber Co,50
@ -831,7 +832,7 @@ expecting conditional block
>=1
# 42. Rules override each other in the order listed in the file
# ** 42. Rules override each other in the order listed in the file
<
10/2009/09,Flubber Co,50
@ -855,7 +856,7 @@ $ ./csvtest.sh
>=0
# 43. Attempt to use space as a separator in the tabular rules
# ** 43. Attempt to use space as a separator in the tabular rules
<
10/2009/09,Flubber Co,50
10/2009/09,Blubber Co,150
@ -879,7 +880,7 @@ start of conditional block found, but no assignment rules afterward
>=1
# 44. handle conditions with & operator
# ** 44. handle conditions with & operator
<
10/2009/09,Flubber Co,50
10/2009/09,Blubber Co,50
@ -903,7 +904,7 @@ $ ./csvtest.sh
>=0
# 45. decimal-mark helps parse ambiguous decimals correctly.
# ** 45. decimal-mark helps parse ambiguous decimals correctly.
# Here it's one thousand, one.
<
2020-01-01,"1,000"
@ -924,7 +925,7 @@ $ ./csvtest.sh
>=
# 46. Again, this time with comma as decimal mark.
# ** 46. Again, this time with comma as decimal mark.
# Here it's one, one thousand.
<
2020-01-01,"1,000"
@ -945,7 +946,7 @@ $ ./csvtest.sh
>=
# 47. Account aliases work when reading from CSV.
# ** 47. Account aliases work when reading from CSV.
<
2020-01-01,10
@ -959,7 +960,7 @@ $ ./csvtest.sh --alias expenses=FOO
>=
# 48. Allow for whitespace in csv amounts
# ** 48. Allow for whitespace in csv amounts
<
2009-09-10,+ $20
2009-09-10, $ +30
@ -995,7 +996,7 @@ $ ./csvtest.sh
>=0
# 49. Handle an entry with all zeros
# ** 49. Handle an entry with all zeros
<
Date;Description;Category;Debit;Credit;Balance
"2020-01-21","Client card point of sale fee",Fees,"0","0","1068.94"
@ -1013,7 +1014,7 @@ $ ./csvtest.sh
>=0
# 50. Allow unicode field references (#1809)
# ** 50. Allow unicode field references (#1809)
<
Date, Description, Id, Amount
12/11/2019, Foo, 123, 10.23
@ -1031,7 +1032,7 @@ $ ./csvtest.sh
>=0
# 51. Throw an error when unable to substitute csv templates
# ** 51. Throw an error when unable to substitute csv templates
<
"2021-12-23","caffe_siciliaexpenses:cibo:dolce","-10.5"
@ -1043,7 +1044,7 @@ $ ./csvtest.sh
>2 /transaction is unbalanced/
>=1
# 52. We can't parse double quotes inside an unquoted field, or other non-RFC4180 data. (#1966)
# ** 52. We can't parse double quotes inside an unquoted field, or other non-RFC4180 data. (#1966)
<
2022-01-01,B"B",C
RULES
@ -1052,7 +1053,7 @@ $ ./csvtest.sh
>2 /unexpected '"'/
>=1
# 53. A top-level skip directive is able to skip lines which would fail to parse as CSV. (#1967)
# ** 53. A top-level skip directive is able to skip lines which would fail to parse as CSV. (#1967)
<
2022-01-01,B"B",C
RULES
@ -1061,7 +1062,7 @@ fields date, b, c
$ ./csvtest.sh
>=
# 54. Empty (zero length) or blank (containing only spaces, tabs, etc.) lines
# ** 54. Empty (zero length) or blank (containing only spaces, tabs, etc.) lines
# are skipped automatically, including inner ones; skip's argument
# counts only the non-empty/blank lines.
<
@ -1082,7 +1083,7 @@ $ ./csvtest.sh
>=
# 55. Some validation is done on account name assignments; trying to
# ** 55. Some validation is done on account name assignments; trying to
# also set an amount there (with 2+ spaces) will be rejected. (#1978)
<
2022-01-01,1

View File

@ -1,3 +1,5 @@
# * accounts error
# ** 1.
$ hledger check accounts -f accounts.j
>2 /hledger: Error: .*accounts.j:4:
\| 2022-01-01

View File

@ -1,3 +1,5 @@
# * assertions error
# ** 1.
$ hledger check -f assertions.j
>2 /hledger: Error: .*assertions.j:4:8:
\| 2022-01-01

View File

@ -1,3 +1,5 @@
# * autobalanced error
# ** 1.
$ hledger check -f autobalanced.j
>2 /hledger: Error: .*autobalanced.j:3-4:
3 \| 2022-01-01

View File

@ -1,3 +1,5 @@
# * balanced error
# ** 1.
$ hledger check balanced -f balanced.j
>2 /hledger: Error: .*balanced.j:6-8:
6 \| 2022-01-01

View File

@ -1,3 +1,5 @@
# * commodities error
# ** 1.
$ hledger check commodities -f commodities.j
>2 /hledger: Error: .*commodities.j:6:
\| 2022-01-01

View File

@ -1,3 +1,5 @@
# * csvamountonenonzero error
# ** 1.
$ hledger check -f csvamountonenonzero.csv
>2 /hledger: Error: in CSV rules:
While processing CSV record: "2022-01-03","1","2"

View File

@ -1,3 +1,5 @@
# * csvamountparse error
# ** 1.
$ hledger check -f csvamountparse.csv
>2 /hledger: Error: error: could not parse "badamount" as an amount
CSV record: "2022-01-03","badamount"

View File

@ -1,3 +1,5 @@
# * csvbalanceparse error
# ** 1.
$ hledger check -f csvbalanceparse.csv
>2 /hledger: Error: error: could not parse "badbalance" as balance1 amount
CSV record: "2022-01-03","badbalance"

View File

@ -1,3 +1,5 @@
# * csvbalancetypeparse error
# ** 1.
$ hledger check -f csvbalancetypeparse.csv
>2 /hledger: Error: balance-type "badtype" is invalid. Use =, ==, =\* or ==\*.
CSV record: "2022-01-01","1"

View File

@ -1,3 +1,5 @@
# * csvdateformat error
# ** 1.
$$$ hledger print -f csvdateformat.csv
>>>2 /hledger: Error: error: could not parse "a" as a date using date format "YYYY\/M\/D", "YYYY-M-D" or "YYYY.M.D"
CSV record: "a","b"

View File

@ -1,3 +1,5 @@
# * csvdateparse error
# ** 1.
$ hledger check -f csvdateparse.csv
>2 /hledger: Error: error: could not parse "baddate" as a date using date format "%Y-%m-%d"
CSV record: "baddate","b"

View File

@ -1,3 +1,5 @@
# * csvdaterule error
# ** 1.
$ hledger check -f csvdaterule.csv
>2 /hledger: Error: offset=0:
Please specify \(at top level\) the date field. Eg: date %1

View File

@ -1,3 +1,5 @@
# * csvdecimalmarkparse error
# ** 1.
$ hledger check -f csvdecimalmarkparse.csv
>2 /hledger: Error: decimal-mark's argument should be "." or "," \(not "badmark"\)
/

View File

@ -1,3 +1,5 @@
# * csvifblocknonempty error
# ** 1.
$ hledger check -f csvifblocknonempty.csv
>2 /hledger: Error: .*csvifblocknonempty.csv.rules:2:1:
\|

View File

@ -1,3 +1,5 @@
# * csviftablefieldnames error
# ** 1.
$ hledger check -f csviftablefieldnames.csv
>2 /hledger: Error: .*csviftablefieldnames.csv.rules:2:9:
\|

View File

@ -1,3 +1,5 @@
# * csviftablenonempty error
# ** 1.
$ hledger check -f csviftablenonempty.csv
>2 /hledger: Error: .*csviftablenonempty.csv.rules:2:1:
\|

View File

@ -1,3 +1,5 @@
# * csviftablevaluecount error
# ** 1.
$ hledger check -f csviftablevaluecount.csv
>2 /hledger: Error: .*csviftablevaluecount.csv.rules:4:1:
\|

View File

@ -1,3 +1,5 @@
# * csvnoinclude error
# ** 1.
$ hledger check -f csvnoinclude.j
>2 /hledger: Error: sorry, CSV files can't be included yet
/

View File

@ -1,3 +1,5 @@
# * csvskipvalue error
# ** 1.
$ hledger check -f csvskipvalue.csv
>2 /hledger: Error: could not parse skip value: "badval"
/

View File

@ -1,3 +1,5 @@
# * csvstatusparse error
# ** 1.
$ hledger print -f csvstatusparse.csv
>2 /hledger: Error: error: could not parse "badstatus" as a cleared status \(should be \*, ! or empty\)
the parse error is: 1:1:

View File

@ -1,3 +1,5 @@
# * csvstdinrules error
# ** 1.
$ sh csvstdinrules.sh
>2 /hledger: Error: please use --rules-file when reading CSV from stdin
/

View File

@ -1,3 +1,5 @@
# * csvtwofields error
# ** 1.
$ hledger check -f csvtwofields.csv
>2 /hledger: Error: CSV record \["b"\] has less than two fields
/

View File

@ -1,3 +1,5 @@
# * ordereddates error
# ** 1.
$ hledger check ordereddates -f ordereddates.j
>2 /hledger: Error: .*ordereddates.j:10:
7 \| 2022-01-02 p

View File

@ -1,3 +1,5 @@
# * parseable error
# ** 1.
$ hledger check -f parseable-dates.j
>2 /hledger: Error: .*parseable-dates.j:3:1:
\|

View File

@ -1,3 +1,5 @@
# * parseable error
# ** 1.
$ hledger check -f parseable-regexps.j
>2 /hledger: Error: .*parseable-regexps.j:3:8:
\|

View File

@ -1,3 +1,5 @@
# * parseable error
# ** 1.
$ hledger check -f parseable.j
>2 /hledger: Error: .*parseable.j:3:2:
\|

View File

@ -1,3 +1,5 @@
# * payees error
# ** 1.
$ hledger check payees -f payees.j
>2 /hledger: Error: .*payees.j:6:
6 \| 2022-01-01 p

View File

@ -1,4 +1,5 @@
# 1. The first posting more than 7 days after latest balance assertion causes this check to fail.
# * check recentassertions errorsrecentassertions error
# ** 1. The first posting more than 7 days after latest balance assertion causes this check to fail.
$ hledger check recentassertions -f recentassertions.j
>2 /Error: .*recentassertions.j:11:
| 2022-01-09 bad1

View File

@ -1,3 +1,5 @@
# * tcclockouttime error
# ** 1.
$ hledger check -f tcclockouttime.timeclock
>2 /hledger: Error: .*tcclockouttime.timeclock:5:1:
\| i 2022-01-01 00:01:00

View File

@ -1,3 +1,5 @@
# * tcorderedactions error
# ** 1.
$ hledger check -f tcorderedactions.timeclock
>2 /hledger: Error: .*tcorderedactions.timeclock:8:1:
8 \| i 2022-01-01 00:01:00

View File

@ -1,3 +1,5 @@
# * uniqueleafnames error
# ** 1.
$ hledger check uniqueleafnames -f uniqueleafnames.j
>2 /hledger: Error: .*uniqueleafnames.j:12:
\| 2022-01-01 p

View File

@ -1,3 +1,4 @@
# * forecast tests
# Test generation of periodic transactions with --forecast.
# Note periodic transaction tests should include a regular transaction
# to pin the start date of forecasted transactions.
@ -14,7 +15,7 @@
expenses:grocery $30
assets:cash
# 1. A balance report with forecasted transactions.
# ** 1. A balance report with forecasted transactions.
$ hledger bal -M -b 2016-11 -e 2017-02 -f - --forecast
Balance changes in 2016-11-01..2017-01-31:
@ -42,7 +43,7 @@ Balance changes in 2016-11-01..2017-01-31:
expenses:grocery $30
assets:cash
# 2. print forecasted transactions, with status and description.
# ** 2. print forecasted transactions, with status and description.
$ hledger print -b 2016-11 -e 2017-02 -f - --forecast
2016-12-31
expenses:housing $600
@ -69,7 +70,7 @@ $ hledger print -b 2016-11 -e 2017-02 -f - --forecast
expenses:grocery $30
assets:cash
# 3. A register with forecasted transactions, with a comment and tag.
# ** 3. A register with forecasted transactions, with a comment and tag.
$ hledger register -b 2016-11 -e 2017-02 -f - --forecast tag:a
2017-01-01 income $-1000 $-1000
expenses:food $20 $-980
@ -91,7 +92,7 @@ $ hledger register -b 2016-11 -e 2017-02 -f - --forecast tag:a
income $-10000 ; bonus
assets:cash
# 4. Check that --forecast generates transactions only after last transaction date in journal.
# ** 4. Check that --forecast generates transactions only after last transaction date in journal.
$ hledger register -b 2015-12 -e 2017-02 -f - assets:cash --forecast
2016-01-01 assets:cash $-10 $-10
2016-12-02 assets:cash $-600 $-610
@ -106,7 +107,7 @@ Y 2000
; a real transaction to set the start of the forecast window
2000/1/1 real
# 5. Y affects M/D partial dates in periodic transactions.
# ** 5. Y affects M/D partial dates in periodic transactions.
# The recur tag shows the original period expression and is not modified.
# Also the --verbose-tags flag adds a visible tag.
$ hledger -f - print --forecast desc:forecast --verbose-tag
@ -123,7 +124,7 @@ Y 2000
; a real transaction to set the start of the forecast window
2000/1/1 real
# 6. Y also sets the month to 1, affecting D dates:
# ** 6. Y also sets the month to 1, affecting D dates:
$ hledger -f - print --forecast desc:forecast
2000-01-15 forecast
@ -137,7 +138,7 @@ Y 2000
; a real transaction to set the start of the forecast window
2000/1/1 real
# 7. Y also sets the day to 1, affecting relative dates:
# ** 7. Y also sets the day to 1, affecting relative dates:
$ hledger -f - print --forecast desc:forecast
2000-02-01 forecast
@ -153,7 +154,7 @@ $ hledger -f - print --forecast desc:forecast
income $-1000
assets:cash
# 8. A balance report with forecast-begin enabling transaction before report end
# ** 8. A balance report with forecast-begin enabling transaction before report end
$ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-
Balance changes in 2016-10-01..2017-01-31:
@ -166,7 +167,7 @@ Balance changes in 2016-10-01..2017-01-31:
|| 0 0 0 0
>=0
# 9. Parse error in malformed forecast period expression
# ** 9. Parse error in malformed forecast period expression
$ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-foobar
>
>2
@ -188,7 +189,7 @@ commodity 1,000.00 USD
~ every 28th day
(a) 1000.00 USD
# 10. Amount display style is applied to forecasted transactions.
# ** 10. Amount display style is applied to forecasted transactions.
$ hledger -f - reg --forecast date:202001
2020-01-01 (a) 1,000.00 USD 1,000.00 USD
2020-01-28 (a) 1,000.00 USD 2,000.00 USD
@ -207,7 +208,7 @@ $ hledger -f - reg --forecast date:202001
Checking = -120
Costs
# 11. Forecast transactions work with balance assignments
# ** 11. Forecast transactions work with balance assignments
$ hledger -f - print -x --forecast -e 2021-11 --verbose-tags
2021-09-01 Normal Balance Assertion Works
Checking -60 = -60
@ -233,7 +234,7 @@ $ hledger -f - print -x --forecast -e 2021-11 --verbose-tags
income:client1 -10 USD
assets:receivables:contractor1
# 12. Generated forecast for weekday transactions
# ** 12. Generated forecast for weekday transactions
$ hledger -f - reg --forecast -b "2021-09-01" -e "2021-09-15" --forecast -w 100
2021-09-01 income:client1 -10 USD -10 USD
assets:receivables:contractor1 10 USD 0
@ -265,7 +266,7 @@ $ hledger -f - reg --forecast -b "2021-09-01" -e "2021-09-15" --forecast -w 100
income:client1 -10 USD
assets:receivables:contractor1
# 13. Generated forecast for weekend transactions
# ** 13. Generated forecast for weekend transactions
$ hledger -f - reg --forecast -b "2021-09-01" -e "2021-09-15" --forecast -w 100
2021-09-04 income:client1 -10 USD -10 USD
assets:receivables:contractor1 10 USD 0
@ -284,7 +285,7 @@ $ hledger -f - reg --forecast -b "2021-09-01" -e "2021-09-15" --forecast -w 100
~ daily
(a) 1
# 14. Arguments to --forecast take precedence over anything. Only generate up to the day before the end date.
# ** 14. Arguments to --forecast take precedence over anything. Only generate up to the day before the end date.
$ hledger -f - reg --forecast="2020-01-01..2020-01-05" -b 2019-12-01 -e 2020-02-01 -H
2020-01-01 (a) 1 1
2020-01-02 (a) 1 2
@ -292,7 +293,7 @@ $ hledger -f - reg --forecast="2020-01-01..2020-01-05" -b 2019-12-01 -e 2020-02-
2020-01-04 (a) 1 4
>=0
# 15. With no arguments to --forecast, we use the report start date if it's after the journal end date.
# ** 15. With no arguments to --forecast, we use the report start date if it's after the journal end date.
$ hledger -f - reg --forecast -b 2021-02-01 -e 2021-02-05 -H
2021-02-01 (a) 1 1001
2021-02-02 (a) 1 1002
@ -300,7 +301,7 @@ $ hledger -f - reg --forecast -b 2021-02-01 -e 2021-02-05 -H
2021-02-04 (a) 1 1004
>=0
# 16. With no arguments to --forecast, we use journal end date if it's after the report start date.
# ** 16. With no arguments to --forecast, we use journal end date if it's after the report start date.
$ hledger -f - reg --forecast -b 2020-12-01 -e 2021-01-05 -H
2021-01-01 (a) 1000 1000
2021-01-02 (a) 1 1001
@ -308,7 +309,7 @@ $ hledger -f - reg --forecast -b 2020-12-01 -e 2021-01-05 -H
2021-01-04 (a) 1 1003
>=0
# 17. With no arguments to --forecast, and no report start, generate from journal end to 180 days from today.
# ** 17. With no arguments to --forecast, and no report start, generate from journal end to 180 days from today.
# We use here the fact that we are at least 180 days from 2021-01-01. This test will fail if you travel back in time!
$ hledger -f - reg --forecast -H
> /1 1360/
@ -318,7 +319,7 @@ $ hledger -f - reg --forecast -H
~ daily
(a) 1
# 18. No real transactions.
# ** 18. No real transactions.
# Arguments to --forecast take precedence over anything. Only generate up to the day before the end date.
$ hledger -f - reg --forecast="2020-01-01..2020-01-05" -b 2019-12-01 -e 2020-01-05 -H
2020-01-01 (a) 1 1
@ -327,7 +328,7 @@ $ hledger -f - reg --forecast="2020-01-01..2020-01-05" -b 2019-12-01 -e 2020-01-
2020-01-04 (a) 1 4
>=0
# 19. No real transactions.
# ** 19. No real transactions.
# With no arguments to --forecast, we use the report start date.
$ hledger -f - reg --forecast -b 2021-02-01 -e 2021-02-05 -H
2021-02-01 (a) 1 1
@ -336,13 +337,13 @@ $ hledger -f - reg --forecast -b 2021-02-01 -e 2021-02-05 -H
2021-02-04 (a) 1 4
>=0
# 20. No real transactions.
# ** 20. No real transactions.
# With no arguments to --forecast, and no report start, generate from today to 180 days from today.
$ hledger -f - reg --forecast -H
> /1 180/
>=0
# 21. Only today's date (or a Y year declaration) affects relative dates;
# ** 21. Only today's date (or a Y year declaration) affects relative dates;
# an explicit report period or forecast period does not. (#1845)
# More explanation:
# - "next quarter" is a relative date meaning "next quarter after the 1st of the current year" (a bug, see 21b).
@ -357,7 +358,7 @@ $ hledger -f- --today=2021-05-01 reg --period=2020-2022 --forecast=2020-2022
2021-10-01 (a) 1 3
>=0
# 21b. Only a Y year declaration, or today's date, affects relative dates;
# # ** 21b. Only a Y year declaration, or today's date, affects relative dates;
# the report period or forecast period do not (#1845).
# Also, without Y, relative dates should be relative to "today" (#1843, #1849).
# Explanation of the below: "next quarter" is a relative date.
@ -373,7 +374,7 @@ $ hledger -f- --today=2021-05-01 reg --period=2020-2022 --forecast=2020-2022
# 2021-10-01 (a) 1 3
# >=0
# 22. Printed JSON with forecast transactions reference periodic transactions source position
# ** 22. Printed JSON with forecast transactions reference periodic transactions source position
<
~ 2023-01-01 Forecasted
A -1
@ -391,7 +392,7 @@ $ hledger -f- print --forecast=2023 -O json
"sourceName": "-"
.*/
# 23. Every nth day of month dates near end of month are calculated correctly
# ** 23. Every nth day of month dates near end of month are calculated correctly
# regardless of forecast start date. (#2032)
<
~ every 31st day of month

View File

@ -1,10 +1,12 @@
# * wide character layout tests
# ALl output should preserve alignment etc. when showing wide characters
# (in apps and fonts which render wide chars as exactly double width).
#
# XXX add commodity symbols and prices to the sample journals
# XXX how to test hledger-ui ?
# 1.
# ** 1.
<
2000-01-01 transaction 1
㐀 㐃㐃1 @ 2 㐂㐂㐂㐂㐂㐂㐂㐂㐂㐂㐂
@ -32,7 +34,7 @@ $ hledger -f - print
>= 0
# 2.
# ** 2.
$ hledger -f chinese.journal register --width 80
2000-01-01 transaction 1 㐀 1 A 1 A
㐀:㐁 -1 A 0
@ -41,7 +43,7 @@ $ hledger -f chinese.journal register --width 80
2000-01-03 transaction 3 㐀:㐁:㐂:㐃:㐄 1 A 1 A
㐀 -1 A 0
# 3.
# ** 3.
$ hledger -f chinese.journal balance --tree
0 㐀:㐁
1 A 㐂
@ -50,7 +52,7 @@ $ hledger -f chinese.journal balance --tree
--------------------
0
# 4.
# ** 4.
$ hledger -f chinese.journal balance -Y
Balance changes in 2000:
@ -63,11 +65,11 @@ Balance changes in 2000:
----------------++------
|| 0
# 5.
# ** 5.
# 6.
# ** 6.
# 7.
# ** 7.
# 8.
# ** 8.

View File

@ -1,4 +1,5 @@
# 1. Simple statement works
# * incomestatement command
# ** 1. Simple statement works
<
2016/1/1
income 1
@ -21,7 +22,7 @@ Income Statement 2016-01-01
==========++============
Net: || -1
# 2. Period reporting works for a specific year
# ** 2. Period reporting works for a specific year
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -61,7 +62,7 @@ Income Statement 2016
===================++=========
Net: || $-40.00
# 3. Period reporting works for two years
# ** 3. Period reporting works for two years
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -102,7 +103,7 @@ Income Statement 2015-01-01..2016-12-31
===================++========================
Net: || $9,960.00
# 4. Period reporting works for one month
# ** 4. Period reporting works for one month
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -141,7 +142,7 @@ Income Statement 2015-10
===================++============
Net: || $10,000.00
# 5. Period reporting works for one month in another year
# ** 5. Period reporting works for one month in another year
<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
@ -179,7 +180,7 @@ Income Statement 2016-10
==========++=====
Net: ||
# 6. Multicolumn test
# ** 6. Multicolumn test
# old (arithmetic sign):
# Income Statement
#
@ -222,7 +223,7 @@ Income Statement 2008
===================++==============================================================================
Net: || $1 0 0 0 0 $-1 0 0 0 0 0 0 0 0
# 7. Multicolumn test (historical)
# ** 7. Multicolumn test (historical)
# old (arithmetic sign):
# Income Statement (Historical Ending Balances)
#
@ -265,7 +266,7 @@ Income Statement 2008-01-31..2008-12-31 (Historical Ending Balances)
===================++================================================================================================================================================
Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
# 8. Percentage test
# ** 8. Percentage test
$ hledger -f sample.journal incomestatement -p 'quarterly 2008' -T --average -% --no-total
Income Statement 2008
@ -281,7 +282,7 @@ Income Statement 2008
expenses:food || 0 50.0 % 0 0 50.0 % 50.0 %
expenses:supplies || 0 50.0 % 0 0 50.0 % 50.0 %
# 9. With --declared, declared leaf accounts are included, and in the right place.
# ** 9. With --declared, declared leaf accounts are included, and in the right place.
<
account revenues
account revenues:aa

View File

@ -1,11 +1,12 @@
# 1. Accounts declared in this parent file and included child file are displayed in correct order.
# * account display order
# ** 1. Accounts declared in this parent file and included child file are displayed in correct order.
$ hledger -f 1/a.j accounts
A1
A2
AA3
AA4
# 2. And with another sibling file, display order is still correct.
# ** 2. And with another sibling file, display order is still correct.
$ hledger -f 1/a.j -f 1/b.j accounts
A1
A2

View File

@ -1,3 +1,5 @@
# * account types
# Here some accounts with type Asset and Cash are declared and
# Liability, Equity, Revenue and Expense accounts are inferred.
<
@ -13,7 +15,7 @@ account liabilities
expenses 1
equity
# 1. bse reports the balance sheet accounts in the proper section.
# ** 1. bse reports the balance sheet accounts in the proper section.
# A Cash account is also an Asset.
$ hledger -f- bse
Balance Sheet With Equity 2020-01-01
@ -41,7 +43,7 @@ Balance Sheet With Equity 2020-01-01
=============++============
Net: || 0
# 2. cashflow reports the Cash account.
# ** 2. cashflow reports the Cash account.
$ hledger -f- cf
Cashflow Statement 2020-01-01
@ -53,7 +55,7 @@ Cashflow Statement 2020-01-01
-------------++------------
|| 1
# 3. is reports the income statement accounts in the proper section.
# ** 3. is reports the income statement accounts in the proper section.
$ hledger -f- is
Income Statement 2020-01-01
@ -73,7 +75,7 @@ Income Statement 2020-01-01
==========++============
Net: || 0
# 4. Just declaring a Cash account should not disable the fallback
# ** 4. Just declaring a Cash account should not disable the fallback
# regexp for Asset accounts.
<
account assets ;
@ -106,7 +108,7 @@ Balance Sheet 2021-01-01
account other ; type:A
# 5. bal detects both
# ** 5. bal detects both
$ hledger -f- bal -N type:A
1 other
1 assets
@ -121,7 +123,7 @@ account a:aa:aaa ; type:L
(a:aa) 1
(a:aa:aaa) 1
# 6. bs will detect proper accounts even with an intervening parent account (#1921)
# ** 6. bs will detect proper accounts even with an intervening parent account (#1921)
$ hledger -f- bs -N
Balance Sheet 2021-01-01

View File

@ -1,6 +1,6 @@
# Amounts, commodity symbols, commodity directives, amount styles..
# * Amounts, commodity symbols, commodity directives, amount styles..
# 1. decimal point/digit grouping chars are autodetected,
# ** 1. decimal point/digit grouping chars are autodetected,
# separately for each commodity, which can be surprising. TODO
# So hledger parses 1 XAU at 1000 USD here:
<
@ -17,7 +17,7 @@ $ hledger -f - bal --flat --no-total -B
# USD-1000000 equity)
# a commodity may contain/end with numbers, if double quoted
# 2. without quotes, fail. XXX parse error should be clearer here
# ** 2. without quotes, fail. XXX parse error should be clearer here
<
2010-04-05 x
a 10 DE0002635307
@ -26,7 +26,7 @@ $ hledger -f- print
>2 /unexpected/
>= 1
# 3. with quotes, ok; quotes appear in print output
# ** 3. with quotes, ok; quotes appear in print output
<
2010-04-05 x
a 10 "DE 0002 635307"
@ -38,14 +38,14 @@ $ hledger -f- print --explicit
>=
# 4. and in other reports too, I guess
# ** 4. and in other reports too, I guess
$ hledger -f- balance
10 "DE 0002 635307" a
-10 "DE 0002 635307" b
--------------------
0
# 5. autobalance with prices
# ** 5. autobalance with prices
<
2016/1/1
saving-card $-105
@ -60,7 +60,7 @@ $ hledger -f- print -x
>=
# 6. The four decimal places of the market price should not alter the
# ** 6. The four decimal places of the market price should not alter the
# canonical style of two decimal places in a's converted-to-B balance
# (#295), but it turns out they do with -V. This can be fixed with a
# commodity directive.
@ -78,7 +78,7 @@ $ hledger -f- bal -V -N
1.00 B a
1.00 B b
# 7. A multi-line commodity directive also works.
# ** 7. A multi-line commodity directive also works.
<
commodity B
format 1.00 B
@ -94,7 +94,7 @@ $ hledger -f- bal -V -N
1.00 B b
# TODO
# 8. From the first amount it should detect that decimal point is period,
# ** 8. From the first amount it should detect that decimal point is period,
# from the second it should detect that there are comma-separated digit groups of size 3,
# giving commodity A a canonical style of 1,000.00 A.
#<
@ -115,7 +115,7 @@ $ hledger -f- bal -V -N
# TODO #749
# 8. Here the amount is parsed as 1. I think (hope) no country uses space
# ** 8. Here the amount is parsed as 1. I think (hope) no country uses space
# for decimal point, so we should parse this as 1000.
<
2018-01-01
@ -123,7 +123,7 @@ $ hledger -f- bal -V -N
$ hledger -f- reg amt:1
# 9. This commodity directive should complain about a missing decimal separator,
# ** 9. This commodity directive should complain about a missing decimal separator,
# which we now require.
<
commodity 1 000 USD
@ -135,7 +135,7 @@ $ hledger -f- bal
>2 /decimal point or decimal comma/
>=1
# 10. After a space-grouped amount, a posting comment should parse.
# ** 10. After a space-grouped amount, a posting comment should parse.
<
2018-01-01
(a) USD 1 000 ;comment
@ -143,7 +143,7 @@ $ hledger -f- bal
$ hledger -f- print
> // # any stdout, no stderr, 0 exit code
# 11. After a space-grouped amount, trailing whitespace should parse.
# ** 11. After a space-grouped amount, trailing whitespace should parse.
<
2018-01-01
(a) USD 1 000
@ -151,7 +151,7 @@ $ hledger -f- print
$ hledger -f- print
> // # any stdout, no stderr, 0 exit code
# 12. After commodity on the right, don't parse tab
# ** 12. After commodity on the right, don't parse tab
<
2020-07-21
a -1600 EUR
@ -166,7 +166,7 @@ $ hledger -f- bal a
0
>=
# 12. Example of surprising decimal mark parsing behaviour.
# ** 12. Example of surprising decimal mark parsing behaviour.
# Without a commodity declaration, these amounts are parsed as 10 and 10000.
# <
# 2000/1/1
@ -179,7 +179,7 @@ $ hledger -f- bal a
# a $-10,000
# b $10,000,000
# 13. A commodity's display style should come from the first-parsed amount
# ** 13. A commodity's display style should come from the first-parsed amount
<
2020-01-01
(a) 1.00 $
@ -196,7 +196,7 @@ $ hledger -f - print
>=
# 14. Balance assertion amounts are always displayed at their full precision,
# ** 14. Balance assertion amounts are always displayed at their full precision,
# overriding commodity styles. (#1465)
<
commodity A 1.
@ -214,7 +214,7 @@ $ hledger -f - print
# The current state of parse errors when commodity symbols containing non-letters
# are not quoted. (#1532)
# 15. Unquoted commodity symbol on the left, gives this long error message.
# ** 15. Unquoted commodity symbol on the left, gives this long error message.
<
2021-01-01
(a) A1B 2
@ -223,7 +223,7 @@ $ hledger -f- print cur:A1B amt:2
>2 /unexpected 'B'/
>=1
# 16. Unquoted commodity symbol on the right, gives this long error message.
# ** 16. Unquoted commodity symbol on the right, gives this long error message.
<
2021-01-01
(a) 1 A2
@ -232,7 +232,7 @@ $ hledger -f- print cur:A1 amt:2
>2 /unexpected '2'/
>=1
# 17. Unquoted commodity symbol on the left ending with numbers, could parse successfully.
# ** 17. Unquoted commodity symbol on the left ending with numbers, could parse successfully.
<
; A 12
2021-01-01
@ -244,7 +244,7 @@ $ hledger -f- print cur:A amt:12
>=
# 18. Unquoted commodity symbol on the right beginning with numbers, could parse successfully.
# ** 18. Unquoted commodity symbol on the right beginning with numbers, could parse successfully.
<
; intended 1 "2A", parses as 12 A
2021-01-01
@ -256,7 +256,7 @@ $ hledger -f- print cur:A amt:12
>=
# 19. Unquoted commodity symbol on the left ending with numbers and E/e (exponent), unspaced,
# ** 19. Unquoted commodity symbol on the left ending with numbers and E/e (exponent), unspaced,
# could parse successfully.
<
@ -270,7 +270,7 @@ $ hledger -f- print cur:A amt:100
>=
# 20. Unquoted commodity symbol on the right beginning with E and numbers, unspaced,
# ** 20. Unquoted commodity symbol on the right beginning with E and numbers, unspaced,
# could parse successfully.
<
@ -284,7 +284,7 @@ $ hledger -f- print cur:e amt:100
>=
# 21. Unquoted commodity symbol on the left consisting of only numbers.
# ** 21. Unquoted commodity symbol on the left consisting of only numbers.
# It could happen..
<
; intended "111" 2, parses as 1112.
@ -314,23 +314,23 @@ P 2021-01-01 A 1000 B
2021-01-05
(a) 1 B
# 22. balance report cur: and amt: query matches currency before valuation/cost
# ** 22. balance report cur: and amt: query matches currency before valuation/cost
$ hledger -f- balance -N -V -B cur:A "amt:<5"
1000 B a
>=
# 23. register report cur: and amt: query matches currency before valuation/cost
# ** 23. register report cur: and amt: query matches currency before valuation/cost
$ hledger -f- register -V -B cur:A "amt:<5"
2021-01-01 (a) 1000 B 1000 B
>=
# 24. aregister report cur: and amt: query matches currency before valuation/cost
# ** 24. aregister report cur: and amt: query matches currency before valuation/cost
$ hledger -f- aregister a -V -B cur:A "amt:<5"
Transactions in a and subaccounts (matching query):
2021-01-01 a 1000 B 1000 B
>=
# 25. print report cur: and amt: query matches currency before valuation/cost
# ** 25. print report cur: and amt: query matches currency before valuation/cost
$ hledger -f- print -V -B a cur:A "amt:<5"
2021-01-01
(a) 1000 B

View File

@ -1,3 +1,4 @@
# * --anon flag
# Input for the following tests:
@ -13,28 +14,28 @@ alias tips=expenses:tips
(tips) 3
# Basic tests on accounts
# 1.
# ** 1.
$ hledger -f- print --anon
> !/assets|liabilities|expenses|tips/
# 2.
# ** 2.
$ hledger -f- reg --anon
> !/assets|liabilities|expenses|tips/
# 3.
# ** 3.
$ hledger -f- bal --anon
> !/assets|liabilities|expenses|tips/
# 4.
# ** 4.
$ hledger -f- accounts --anon
> !/assets|liabilities|expenses|tips/
# Basic tests on descriptions and comments
# 5.
# ** 5.
$ hledger -f- print --anon
> !/borrow|signed/
# 6.
# ** 6.
$ hledger -f- reg --anon
> !/borrow/
# Basic tests on transaction code
# 7.
# ** 7.
$ hledger -f- print --anon
> !/receipt/

View File

@ -1,3 +1,5 @@
# * auto posting rules
<
= ^income
(liabilities:tax) *.33 ; income tax
@ -11,7 +13,7 @@
assets:cash $20
assets:bank
# 1. print. Auto-generated postings are inserted below the matched one.
# ** 1. print. Auto-generated postings are inserted below the matched one.
# With --verbose-tags, informative tags will also be added.
$ hledger print -f- --auto --verbose-tags
2016-01-01 paycheck ; modified:
@ -27,7 +29,7 @@ $ hledger print -f- --auto --verbose-tags
>=
# 2. register
# ** 2. register
$ hledger register -f- --auto
2016-01-01 paycheck income:remuneration $-100 $-100
(liabilities:tax) $-33 $-133
@ -38,7 +40,7 @@ $ hledger register -f- --auto
assets:bank $-20 $-38
>=
# 3. balance
# ** 3. balance
$ hledger balance -f- --auto --tree
$115 assets
$95 bank
@ -60,7 +62,7 @@ $ hledger balance -f- --auto --tree
(trigger) 1
(target) 1 = 11 ; this assertion would not fail, auto posting will be taken into account
# 4.
# ** 4.
$ hledger register -f- --auto
2018-01-01 (trigger) 1 1
(target) 10 11
@ -77,7 +79,7 @@ $ hledger register -f- --auto
expenses:groceries:food
assets:bank:checking $-20
# 5.
# ** 5.
$ hledger print -f- --auto
2018-10-07 * MARKET
expenses:groceries:food
@ -96,7 +98,7 @@ $ hledger print -f- --auto
2018/1/1
(assets:billable:client1) 0.50h @ $90
# 6.
# ** 6.
$ hledger -f- print --auto -x
2018-01-01
(assets:billable:client1) 0.50h @ $90
@ -114,7 +116,7 @@ $ hledger -f- print --auto -x
2018/1/1
(assets:billable:client1) 0.50h
# 7.
# ** 7.
$ hledger -f- print --auto -x
2018-01-01
(assets:billable:client1) 0.50h
@ -132,7 +134,7 @@ $ hledger -f- print --auto -x
2018/1/1
(assets:billable:client1) 0.50h @ $90
# 8.
# ** 8.
$ hledger -f- print --auto -x
2018-01-01
(assets:billable:client1) 0.50h @ $90
@ -159,7 +161,7 @@ $ hledger -f- print --auto -x
budget:other
budget:available =$0
# 9.
# ** 9.
$ hledger print -f- --auto
>2 /Balance assignments and auto postings may not be combined/
>=1
@ -177,7 +179,7 @@ $ hledger print -f- --auto
Expenses:Joint:Widgets $100.00 @ £0.50
Assets:Joint:Bank -£50.00
# 10.
# ** 10.
$ hledger -f- print --auto --verbose-tags
2018-01-01 ; modified:
Expenses:Joint:Widgets $100.00 @ £0.50
@ -199,7 +201,7 @@ $ hledger -f- print --auto --verbose-tags
Expenses:Joint:Widgets $100.00 @@ £50
Assets:Joint:Bank -£50.00
# 11.
# ** 11.
$ hledger -f- print --auto
2018-01-01
Expenses:Joint:Widgets $100.00 @@ £50
@ -228,7 +230,7 @@ $ hledger -f- print --auto
Expenses:Joint:Widgets $100.00
Assets:Joint:Bank -£50.00
# 12.
# ** 12.
$ hledger -f- print --auto
2018-01-01
Expenses:Joint:Widgets $100.00
@ -256,7 +258,7 @@ $ hledger -f- print --auto
assets:cash $20
assets:bank
# 13.
# ** 13.
$ hledger print -f- --auto --forecast -b 2016-01 -e 2016-03
2016-01-03 withdraw
assets:cash $20
@ -271,7 +273,7 @@ $ hledger print -f- --auto --forecast -b 2016-01 -e 2016-03
>=
# 14. and they don't force --auto on
# ** 14. and they don't force --auto on
$ hledger print -f- --forecast -b 2016-01 -e 2016-03
2016-01-03 withdraw
assets:cash $20
@ -294,7 +296,7 @@ $ hledger print -f- --forecast -b 2016-01 -e 2016-03
expenses:groceries:food
assets:bank:checking $-20
# 15.
# ** 15.
$ hledger -f- register --auto
2020-10-07 MARKET ex:groceries:food $20 $20
[budget:groceries] $-20 0
@ -311,7 +313,7 @@ $ hledger -f- register --auto
a EUR -10.00 ; :tax20:
b EUR 12.00
# 16. Transaction balancing sees auto postings ?
# ** 16. Transaction balancing sees auto postings ?
# $ hledger -f- print -x --auto
# 2018-12-18
# a EUR -10.00 ; :tax20:
@ -320,12 +322,12 @@ $ hledger -f- register --auto
#
# >=
# 16. No, transaction must be balanced both with and without auto postings.
# ** 16. No, transaction must be balanced both with and without auto postings.
$ hledger -f- print -x --auto
>2 /unbalanced/
>=1
# 17. Commodity display styles are applied to auto posting amounts.
# ** 17. Commodity display styles are applied to auto posting amounts.
<
2020-01-20
(a) 1 A
@ -342,7 +344,7 @@ $ hledger -f- print --auto
>=0
# 18. Auto-generated postings with currency matching only matches amounts with that currency in an auto posting (#1582)
# ** 18. Auto-generated postings with currency matching only matches amounts with that currency in an auto posting (#1582)
<
= assets cur:USD
(b:USD) *1
@ -365,7 +367,7 @@ $ hledger -f- print --auto
>=0
# 19. Auto-generated postings match only the amounts which match amount query.
# ** 19. Auto-generated postings match only the amounts which match amount query.
<
= assets amt:>50
(b) *1
@ -384,7 +386,7 @@ $ hledger -f- print --auto
>=0
# 20. Auto-generated postings apply on auto-balanced periodic postings.
# ** 20. Auto-generated postings apply on auto-balanced periodic postings.
<
2021-01-01 Fixed
Checking -10

View File

@ -1,7 +1,6 @@
#!/usr/bin/env shelltest
# balance assertion & balance assignment tests
# * balance assertions and balance assignments
# 1. test some balance assertions
# ** 1. test some balance assertions
<
2013/1/1
a $1 =$1
@ -20,7 +19,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 2. same entries as 1 but different parse order, assertion should still pass based on date
# ** 2. same entries as 1 but different parse order, assertion should still pass based on date
<
2013/1/1
a $1 =$1
@ -39,7 +38,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 3. like 1 but switch order of postings in last entry,
# ** 3. like 1 but switch order of postings in last entry,
# assertion should fail and exit code should be non zero
<
2013/1/1
@ -59,7 +58,7 @@ $ hledger -f - stats
>2 /Error: -:11:12/
>=1
# 4. should also work without commodity symbols
# ** 4. should also work without commodity symbols
<
2013/1/1
(a) 1 =1
@ -68,7 +67,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 5. should work for fractional amount with trailing zeros
# ** 5. should work for fractional amount with trailing zeros
<
2013/1/1
a $1.20 =$1.20
@ -86,7 +85,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 6. assertions currently check only a single commodity's balance, like Ledger
# ** 6. assertions currently check only a single commodity's balance, like Ledger
<
1/2
(a) A1
@ -98,7 +97,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 7. balances should accumulate (#195)
# ** 7. balances should accumulate (#195)
<
1/1
(a) 1F = 1F
@ -111,7 +110,7 @@ $ hledger -f - stats
> !/assertion failed/
>=0
# 8. what should happen here ? Currently,
# ** 8. what should happen here ? Currently,
# in a, 3.4 EUR @@ $5.6 and -3.4 EUR cancel out (wrong ?)
# in b,
#
@ -133,7 +132,7 @@ $ hledger -f - stats
# > /Transactions/
# >=0
# 8. Using balance assignment to set balances.
# ** 8. Using balance assignment to set balances.
<
2013/1/1
a $1.20
@ -152,7 +151,7 @@ $ hledger -f - stats
>=0
# 9. Multiple assertions for an account in the same transaction.
# ** 9. Multiple assertions for an account in the same transaction.
<
2013/1/1
a $1 =$1
@ -171,7 +170,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 10. Multiple assertions and assignments for an account in the same transaction.
# ** 10. Multiple assertions and assignments for an account in the same transaction.
<
2013/1/1
a $1 =$1
@ -201,7 +200,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 11. Assignments and virtual postings
# ** 11. Assignments and virtual postings
<
2013/1/1
b
@ -218,7 +217,7 @@ $ hledger -f - stats
$ hledger -f - stats
> /Transactions/
>=0
# 12. Having both assignments and posting dates is not supported.
# ** 12. Having both assignments and posting dates is not supported.
<
2013/1/1
a $1 =$1
@ -228,7 +227,7 @@ $ hledger -f - stats
>2 /Balance assignments and custom posting dates may not be combined/
>=1
# 13. Posting Date
# ** 13. Posting Date
<
2011/5/5
@ -252,7 +251,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 14. Mix different commodities
# ** 14. Mix different commodities
<
2016/1/1
a $1
@ -266,7 +265,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 15. Mix different commodities and assignments
# ** 15. Mix different commodities and assignments
<
2016/1/1
a $1
@ -287,7 +286,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 16. Total assertions (==) parse correctly
# ** 16. Total assertions (==) parse correctly
<
2016/1/1
a $1
@ -300,7 +299,7 @@ $ hledger -f - stats
> /Transactions/
>=0
# 17. Total assertions consider entire multicommodity amount
# ** 17. Total assertions consider entire multicommodity amount
<
2016/1/1
a $1
@ -317,7 +316,7 @@ $ hledger -f - stats
>2 /Error: -:10:15:/
>=1
# 18. Mix different commodities and total assignments
# ** 18. Mix different commodities and total assignments
<
2016/1/1
a $1
@ -336,21 +335,21 @@ $ hledger -f - stats
> /Transactions/
>=0
# 19. Cost is ignored when checking balance assertions.
# ** 19. Cost is ignored when checking balance assertions.
<
2023-01-01
(a) 1A @ 1B = 1A
$ hledger -f- check
# 20. The asserted balance may have a cost, also ignored
# ** 20. The asserted balance may have a cost, also ignored
<
2023-01-01
(a) 1A @ 1B = 1A @ 2B
$ hledger -f- check
# 21. A cost does not disrupt highlighting in the balance assertion error message.
# ** 21. A cost does not disrupt highlighting in the balance assertion error message.
<
2023-01-01
(a) 1A @ 1B = 5A
@ -362,7 +361,7 @@ $ hledger -f- check
/
>=1
# 22. Balance assignments may have a cost, and it's used for the posting amount.
# ** 22. Balance assignments may have a cost, and it's used for the posting amount.
<
2019/01/01
(a) = 1A @ 2B
@ -374,7 +373,7 @@ $ hledger -f- print --explicit
>=0
# 23. The exact amounts are compared; display precision does not affect assertions.
# ** 23. The exact amounts are compared; display precision does not affect assertions.
<
commodity $1000.00
@ -388,7 +387,7 @@ $ hledger -f- print
> /2019/
>=0
# 24. This fails
# ** 24. This fails
<
commodity $1000.00
@ -402,7 +401,7 @@ $ hledger -f- print
>2 /a difference of.*0\.004/
>=1
# 25. This fails
# ** 25. This fails
<
commodity $1000.00
@ -416,7 +415,7 @@ $ hledger -f- print
>2 /a difference of.*0\.0001/
>=1
# 26. Inclusive assertions include balances from subaccounts.
# ** 26. Inclusive assertions include balances from subaccounts.
<
2019/1/1
(a) X1
@ -440,7 +439,7 @@ $ hledger -f- print
>=0
# 27. Inclusive balance assignments also work (#1207).
# ** 27. Inclusive balance assignments also work (#1207).
<
2020-01-25
(a:aa) 1
@ -470,7 +469,7 @@ $ hledger -f- print -x
>=0
# 28. When balance assignment with a cost generates two postings in one commodity,
# ** 28. When balance assignment with a cost generates two postings in one commodity,
# the balance assertion appears only on the last, not both. (#1965)
<
2022-01-01

View File

@ -1,4 +1,6 @@
# 1. accept a blank description
# * blank descriptions
# ** 1. accept a blank description
<
2010/1/1
a 1
@ -7,7 +9,7 @@
$ hledger -f- print
> //
# 2. same, but no separator space after the date
# ** 2. same, but no separator space after the date
<
2010/1/1
a 1

View File

@ -1,6 +1,6 @@
# comment tests
# * file, transaction and posting comments
# 1. several comment characters allowed for file characters;
# ** 1. several comment characters allowed for file characters;
# print shows in-transaction & posting comments;
# comment line is preserved, starting column is not.
<
@ -31,7 +31,7 @@ $ hledger -f - print
>= 0
# 2. transaction comments must use ;
# ** 2. transaction comments must use ;
<
2017/1/1 this # and * are not ; the comment
$ hledger -f - print
@ -39,7 +39,7 @@ $ hledger -f - print
>= 0
# 3. posting comments must use ;
# ** 3. posting comments must use ;
<
2017/1/1
a 0 # hash & star not allowed for posting comments
@ -48,7 +48,7 @@ $ hledger -f - print
>2 //
>= 1
# 4. register does not show comments
# ** 4. register does not show comments
<
2010/1/1 x
a 1 ; comment

View File

@ -1,11 +1,11 @@
# Cost-related tests
# * Costs
<
2011/01/01
expenses:foreign currency €100 @ $1.35
assets
# 1. print a transaction with an explicit unit cost
# ** 1. print a transaction with an explicit unit cost
$ hledger -f- print --explicit
2011-01-01
expenses:foreign currency €100 @ $1.35
@ -13,7 +13,7 @@ $ hledger -f- print --explicit
>=0
# 2. -B/--cost converts to the cost price's commodity
# ** 2. -B/--cost converts to the cost price's commodity
$ hledger -f- print --explicit --cost
2011-01-01
expenses:foreign currency $135.00
@ -25,7 +25,7 @@ $ hledger -f- print --explicit --cost
expenses:foreign currency €100 @ $1.35
assets $-135.00
# 3. --infer-equity generates conversion postings,
# ** 3. --infer-equity generates conversion postings,
# and with --verbose-tags, they will be visibly tagged.
$ hledger -f- print --infer-equity --verbose-tags
2011-01-01
@ -36,7 +36,7 @@ $ hledger -f- print --infer-equity --verbose-tags
>=0
# 4. With --cost, --infer-equity is ignored
# ** 4. With --cost, --infer-equity is ignored
$ hledger -f- print --cost --infer-equity
2011-01-01
expenses:foreign currency $135.00
@ -49,7 +49,7 @@ $ hledger -f- print --cost --infer-equity
expenses:foreign currency €100 @@ $135
assets
# 5. print a transaction with a total cost
# ** 5. print a transaction with a total cost
$ hledger -f - print --explicit
2011-01-01
expenses:foreign currency €100 @@ $135
@ -57,7 +57,7 @@ $ hledger -f - print --explicit
>=0
# 6. when the balance has exactly two commodities, both without cost,
# ** 6. when the balance has exactly two commodities, both without cost,
# infer an implicit balancing cost (conversion rate) for the first one in terms of the second.
<
2011/01/01
@ -79,7 +79,7 @@ $ hledger -f - print --explicit
>=0
# 7. another, from ledger tests. Just one posting to price so uses @@.
# ** 7. another, from ledger tests. Just one posting to price so uses @@.
<
2002/09/30 * 1a1a6305d06ce4b284dba0d267c23f69d70c20be
c56a21d23a6535184e7152ee138c28974f14280c 866.231000 GGGGG
@ -92,7 +92,7 @@ $ hledger -f - print --explicit
>=0
# 8. when the balance has more than two commodities, don't bother
# ** 8. when the balance has more than two commodities, don't bother
<
2011/01/01
expenses:foreign currency €100
@ -102,7 +102,7 @@ $ hledger -f - print
>2 /transaction is unbalanced/
>= !0
# 9. another
# ** 9. another
<
2011/01/01
expenses:foreign currency €99
@ -117,7 +117,7 @@ $ hledger -f - balance -B
0
>=0
# 10. transaction in two commodities should balance out properly
# ** 10. transaction in two commodities should balance out properly
<
2011/01/01 x
a 10£ @@ 16$
@ -130,7 +130,7 @@ $ hledger -f - balance --cost
0
>=0
# 11. --value=cost,XXX is deprecated, but should still work (for now)
# ** 11. --value=cost,XXX is deprecated, but should still work (for now)
$ hledger -f - balance --value=cost,XXX
16$ a
-16$ b
@ -138,7 +138,7 @@ $ hledger -f - balance --value=cost,XXX
0
>=0
# 12. conversion postings should be generated when called --infer-equity
# ** 12. conversion postings should be generated when called --infer-equity
$ hledger -f - balance --infer-equity
10£ a
-16$ b
@ -148,7 +148,7 @@ $ hledger -f - balance --infer-equity
0
>=0
# 13. transaction should be left unbalanced when called without --cost or --infer-equity
# ** 13. transaction should be left unbalanced when called without --cost or --infer-equity
$ hledger -f - balance
10£ a
-16$ b
@ -157,7 +157,7 @@ $ hledger -f - balance
10£
>=0
# 14. The balancing cost should still be inferred properly, with proper sign,
# ** 14. The balancing cost should still be inferred properly, with proper sign,
# if the first amount is negative
<
2011/01/01 x
@ -169,7 +169,7 @@ $ hledger -f - balance -N
16$ b
>=0
# 15. Should not infer balancing costs when --strict is specified
# ** 15. Should not infer balancing costs when --strict is specified
$ hledger -f - balance --strict
>2 /transaction is unbalanced/
>=1
@ -179,12 +179,12 @@ $ hledger -f - balance --strict
a -10£
b -16$
# 16. A balancing cost can not be inferred when BOTH amounts are negative
# ** 16. A balancing cost can not be inferred when BOTH amounts are negative
$ hledger -f - balance
>2 /transaction is unbalanced/
>=1
# 17. Differently-priced lots of a commodity should be merged in balance report
# ** 17. Differently-priced lots of a commodity should be merged in balance report
<
2011/1/1
(a) £1 @ $2
@ -198,7 +198,7 @@ $ hledger -f - balance
£2
>=0
# 18. this should balance
# ** 18. this should balance
<
2011/1/1
a 1h @ $10
@ -211,7 +211,7 @@ $ hledger -f - balance --no-total
$-30 c
>= 0
# 19. these balance because of the unit costs, and should parse successfully
# ** 19. these balance because of the unit costs, and should parse successfully
<
1/1
a 1X @ 2Y
@ -221,11 +221,11 @@ $ hledger -f - balance --no-total
-1X a
>= 0
# 20.
# ** 20.
$ hledger -f - balance --no-total -B
>= 0
# 21. likewise with total costs. Note how the primary amount's sign is used.
# ** 21. likewise with total costs. Note how the primary amount's sign is used.
<
1/1
a 1X @@ 1Y
@ -235,7 +235,7 @@ $ hledger -f - balance --no-total
-1X a
>= 0
# 22.
# ** 22.
$ hledger -f - balance --no-total -B
>= 0
@ -266,7 +266,7 @@ $ hledger -f - balance --no-total -B
a A -1
b B -1 @@ A -1
# 23. All these transactions are considered balanced
# ** 23. All these transactions are considered balanced
$ hledger -f- print -x
2022-01-01 Positive Unit cost
a A 1
@ -294,7 +294,7 @@ $ hledger -f- print -x
>=
# 24. Here they are converted to cost
# ** 24. Here they are converted to cost
$ hledger -f- print -xB
2022-01-01 Positive Unit cost
a A 1
@ -322,7 +322,7 @@ $ hledger -f- print -xB
>=
# 25. Here are the market prices inferred, since 1.26:
# ** 25. Here are the market prices inferred, since 1.26:
$ hledger -f- --infer-market-prices prices
P 2022-01-01 B A 1
P 2022-01-01 B A 1.0
@ -331,7 +331,7 @@ P 2022-01-02 B A -1.0
P 2022-01-03 B A -1
P 2022-01-03 B A -1.0
# 26. here, a's primary amount is 0, and its cost is 1Y; b is the assigned auto-balancing amount of -1Y (per issue 69)
# ** 26. here, a's primary amount is 0, and its cost is 1Y; b is the assigned auto-balancing amount of -1Y (per issue 69)
<
1/1
a 1X @@ 1Y
@ -344,18 +344,18 @@ $ hledger -f - balance --no-total -E
-1Y b
>= 0
# 27. Without -E, a should be hidden because its balance is zero, even though it has a non-zero cost.
# ** 27. Without -E, a should be hidden because its balance is zero, even though it has a non-zero cost.
$ hledger -f - balance --no-total
-1Y b
>= 0
# 28. the above with -B
# ** 28. the above with -B
$ hledger -f - balance --no-total -E -B
1Y a
-1Y b
>= 0
# 29. The equity account used by --infer-equity can be customised
# ** 29. The equity account used by --infer-equity can be customised
<
account equity:trades ; type:V
@ -372,7 +372,7 @@ $ hledger -f- print --infer-equity
>=0
# 30. Inferred equity postings are generated early enough to match filters
# ** 30. Inferred equity postings are generated early enough to match filters
<
2011/01/01
expenses:foreign currency €100 @ $1.35
@ -384,7 +384,7 @@ Transactions in equity:conversion and subaccounts:
€-100 €-100
>=0
# 31. Infer cost with first matching posting when equity postings are present
# ** 31. Infer cost with first matching posting when equity postings are present
<
2011/01/01
expenses:foreign currency €100
@ -401,7 +401,7 @@ $ hledger -f- print --infer-costs
>=0
# 32. Infer cost and convert to cost when equity postings are present
# ** 32. Infer cost and convert to cost when equity postings are present
$ hledger -f- print --infer-costs --cost
2011-01-01
expenses:foreign currency $135
@ -409,7 +409,7 @@ $ hledger -f- print --infer-costs --cost
>=0
# 33. Do not infer equity postings when they are specified manually
# ** 33. Do not infer equity postings when they are specified manually
$ hledger -f- print --infer-equity --infer-costs
2011-01-01
expenses:foreign currency €100 @@ $135
@ -419,7 +419,7 @@ $ hledger -f- print --infer-equity --infer-costs
>=0
# 34. Inferred equity postings with non-standard conversion account
# ** 34. Inferred equity postings with non-standard conversion account
<
account whoopwhoop ; type:V
@ -438,7 +438,7 @@ $ hledger -f- print --infer-costs
>=0
# 35. Can manually make another posting match
# ** 35. Can manually make another posting match
<
2011/01/01
assets $-135
@ -455,7 +455,7 @@ $ hledger -f- print --infer-costs
>=0
# 36. Can manually match lots of different posting groups so long as there is no conflict
# ** 36. Can manually match lots of different posting groups so long as there is no conflict
<
2011/01/01
expenses:food €110 @@ £80
@ -480,7 +480,7 @@ $ hledger -f- print --show-costs --infer-costs
>=0
# 37. And convert to cost
# ** 37. And convert to cost
$ hledger -f- print --infer-costs --cost
2011-01-01
expenses:food £80
@ -490,7 +490,7 @@ $ hledger -f- print --infer-costs --cost
>=0
# 38. Transaction posts and equity conversion postings are fine
# ** 38. Transaction posts and equity conversion postings are fine
<
2011/01/01
expenses:foreign currency €100 @ $1.35
@ -553,7 +553,7 @@ $ hledger -f- print --infer-costs
# >2 /There is not a unique posting which matches the conversion posting pair/
# >=1
# 39. A multicommodity transaction with conversion postings that we can't
# ** 39. A multicommodity transaction with conversion postings that we can't
# automatically match up with the corresponding other postings should be ignored,
# not an error. (#2045)
<
@ -574,7 +574,7 @@ $ hledger -f- print
>=
# 40. We can combine other amounts into one posting, if they still match up.
# ** 40. We can combine other amounts into one posting, if they still match up.
<
2011-01-01
expenses:foreign currency €100 @ $1.35
@ -605,7 +605,7 @@ $ hledger -f- print --infer-costs
>=0
# 41. Matching costful postings and conversion postings is done at the precision
# ** 41. Matching costful postings and conversion postings is done at the precision
# of the conversion posting, tolerating smaller decimal differences (#2041).
# Here 84.01 * 2.495 GEL is 209.60495 GEL, which is considered to match 209.60 GEL
# because we use the latter's 2 digit precision.

View File

@ -1,5 +1,8 @@
# * date parsing
# invalid dates should be rejected
# 1. valid month and day, but flipped
# ** 1. valid month and day, but flipped
<
2010/31/12 x
a 1
@ -7,7 +10,8 @@
$ hledger -f- print
>2 /date is invalid/
>= 1
# 2. too-large day
# ** 2. too-large day
<
2010/12/32 x
a 1
@ -15,7 +19,8 @@ $ hledger -f- print
$ hledger -f- print
>2 /date is invalid/
>= 1
# 3. 29th feb on leap year should be ok
# ** 3. 29th feb on leap year should be ok
<
2000/2/29 x
a 1
@ -26,7 +31,8 @@ $ hledger -f- print
b
>= 0
# 4. 29th feb on non-leap year should fail
# ** 4. 29th feb on non-leap year should fail
<
2001/2/29 x
a 1
@ -34,7 +40,8 @@ $ hledger -f- print
$ hledger -f- print
>2 /date is invalid/
>= 1
# 5. dates must be followed by whitespace or newline
# ** 5. dates must be followed by whitespace or newline
<
2015/9/6*
a 0

View File

@ -1,6 +1,6 @@
# account names
# * account directive
# 1. "apply account" and "alias" affect "account" directives.
# ** 1. "apply account" and "alias" affect "account" directives.
<
apply account c
alias c:a=b
@ -8,7 +8,7 @@ account a
$ hledger -f - accounts
b
# 2. account directives can declare account type.
# ** 2. account directives can declare account type.
# Here "asset" is a liability, despite the name. So are its subaccounts.
# "b" is a liability. "b:bb" is an asset.
<
@ -38,7 +38,7 @@ Balance Sheet 2018-01-01
asset:a || -1
b || -2
# 3. Tree mode. A little weird, b appears twice.
# ** 3. Tree mode. A little weird, b appears twice.
# It must be shown above bb, but since not an asset, its balance is excluded there.
# It is shown again in the liabilities section, this time with balance.
$ hledger -f - bs -N
@ -55,7 +55,7 @@ Balance Sheet 2018-01-01
asset:a || -1
b || -2
# 4. It ignores subdirectives.
# ** 4. It ignores subdirectives.
<
account Expenses:Food
note This account is all about the chicken!
@ -68,7 +68,7 @@ account Expenses:Food
$ hledger -f- accounts
Expenses:Food
# 5. It does not allow parentheses in names.
# ** 5. It does not allow parentheses in names.
<
account (a)
@ -83,7 +83,7 @@ expecting account name without brackets
>=1
# 6. It does not allow brackets in names.
# ** 6. It does not allow brackets in names.
<
account [a]

View File

@ -1,45 +1,45 @@
# commodity directive
# * commodity directive
# 1 requires an argument
# ** 1. requires an argument
<
commodity
$ hledger -f - commodities
>2 /unexpected newline/
>=1
# 2 should require an amount, not just a symbol (but doesn't, TODO)
# ** 2. should require an amount, not just a symbol (but doesn't, TODO)
<
commodity A
$ hledger -f - commodities
A
# 3 when there is an amount, a decimal mark is required
# ** 3. when there is an amount, a decimal mark is required
<
commodity A 1
$ hledger -f - commodities
>2 /Please include a decimal point or decimal comma/
>=1
# 4
# ** 4.
<
commodity A 1.
$ hledger -f - commodities
A
# 5
# ** 5.
<
commodity A 1,00
$ hledger -f - commodities
A
# 6 accepts a format subdirective
# ** 6. accepts a format subdirective
<
commodity A
format 1.0 A
$ hledger -f - commodities
A
# 7 which also requires an amount argument
# ** 7. which also requires an amount argument
<
commodity A
format
@ -47,7 +47,7 @@ $ hledger -f - commodities
>2 /expecting amount/
>=1
# 8 which must have the same commodity symbol
# ** 8. which must have the same commodity symbol
<
commodity A
format 1
@ -55,7 +55,7 @@ $ hledger -f - commodities
>2 /commodity directive symbol .* and format directive symbol .* should be the same/
>=1
# 9 when there's a format subdirective, the main directive should have just a symbol
# ** 9. when there's a format subdirective, the main directive should have just a symbol
# (and the error message should be clear, TODO)
<
commodity A 1.
@ -64,7 +64,7 @@ $ hledger -f - commodities
>2 /unexpected 'f'/
>=1
# 10 it ignores unrecognised subdirectives
# ** 10. it ignores unrecognised subdirectives
<
commodity USD
note American Dollars

View File

@ -1,4 +1,6 @@
# 1. Commas specified as decimal mark
# * decimal-mark directive
# ** 1. Commas specified as decimal mark
$ hledger -f commas.journal bal
-199,00 RUB Assets:Yandex
199,00 RUB Expenses:Unknown:RUB
@ -6,7 +8,7 @@ $ hledger -f commas.journal bal
0
>=0
# 2. Include file with different decimal mark
# ** 2. Include file with different decimal mark
<
commodity 1000.00 RUB
include commas.journal

View File

@ -1,9 +1,11 @@
# * D directive
# a default commodity defined with the D directive will be used for any
# subsequent commodity-less posting amounts. The sample amount's display style
# is also applied, and the resulting amount may end up setting the canonical
# display style for the commodity.
# 1. no default commodity
# ** 1. no default commodity
<
2010/1/1
a 1000
@ -16,7 +18,7 @@ $ hledger -f- print
>=0
# 2. pound, two decimal places, no digit group separator
# ** 2. pound, two decimal places, no digit group separator
<
D £1000.00
2010/1/1
@ -30,7 +32,7 @@ $ hledger -f- print
>=0
# 3. dollar, comma decimal point, three decimal places, no digit group separator
# ** 3. dollar, comma decimal point, three decimal places, no digit group separator
<
D $1,000
2010/1/1
@ -44,7 +46,7 @@ $ hledger -f- print
>=0
# 4. dollar, three digit group separator, one decimal place
# ** 4. dollar, three digit group separator, one decimal place
<
D $1,000.0
2010/1/1
@ -56,7 +58,7 @@ $ hledger -f- print
>=0
# 5. A D directive affects all aspects of display style,
# ** 5. A D directive affects all aspects of display style,
# including limiting the display precision, like a commodity directive (#1187).
<
D 1,000.0 A
@ -69,7 +71,7 @@ $ hledger -f- print
>=0
# 6. A default commodity should not affect parsing of
# ** 6. A default commodity should not affect parsing of
# automated posting multiplier amounts.
<
D $1000.

View File

@ -1,4 +1,6 @@
# 1. payee ignores subdirectives
# * payee directive
# ** 1. payee ignores subdirectives
<
payee KFC
alias KENTUCKY FRIED CHICKEN

View File

@ -1,3 +1,5 @@
# balance --gain report
<
P 1999/12/01 stock 1 A
P 2000/01/01 stock 2 A
@ -19,7 +21,7 @@ P 2000/02/01 B 6 A
(assets:new) 1 stock @ 3 A
(assets:b) 1 stock @ 3 B
# 1. multicolumn balance report showing changes in gain
# ** 1. multicolumn balance report showing changes in gain
$ hledger -f- bal -M --gain --no-total
Incremental gain in 1999-12-01..2000-02-29, valued at period ends:
@ -29,7 +31,7 @@ Incremental gain in 1999-12-01..2000-02-29, valued at period ends:
assets:new || 0 -1 A 1 A
assets:old || -2 A 2 A 2 A
# 2. multibalance report showing changes in gain including some historical postings
# ** 2. multibalance report showing changes in gain including some historical postings
$ hledger -f- bal -M --gain -b 2000 --no-total
Incremental gain in 2000-01-01..2000-02-29, valued at period ends:
@ -39,7 +41,7 @@ Incremental gain in 2000-01-01..2000-02-29, valued at period ends:
assets:new || -1 A 1 A
assets:old || 2 A 2 A
# 3. historical gain report
# ** 3. historical gain report
$ hledger -f- bal -M --gain -b 2000 --no-total --historical
Historical gain in 2000-01-01..2000-02-29, valued at period ends:
@ -49,7 +51,7 @@ Historical gain in 2000-01-01..2000-02-29, valued at period ends:
assets:new || -1 A 0
assets:old || 0 2 A
# 4. cumulative gain report
# ** 4. cumulative gain report
$ hledger -f- bal -M --gain -b 2000 --no-total --cumulative
Cumulative gain in 2000-01-01..2000-02-29, valued at period ends:
@ -59,7 +61,7 @@ Cumulative gain in 2000-01-01..2000-02-29, valued at period ends:
assets:new || -1 A 0
assets:old || 2 A 4 A
# 5. use a different valuation strategy
# ** 5. use a different valuation strategy
$ hledger -f- bal -M --gain --no-total --value=2000-02-01
Incremental gain in 1999-12-01..2000-01-31, valued at 2000-02-01:
@ -68,7 +70,7 @@ Incremental gain in 1999-12-01..2000-01-31, valued at 2000-02-01:
assets:b || 0 -15 A
assets:old || 2 A 0
# 6. use a different valuation strategy for historical
# ** 6. use a different valuation strategy for historical
$ hledger -f- bal -M --gain --no-total --value=2000-02-01 -b 2000 --historical
Historical gain in 2000-01, valued at 2000-02-01:
@ -77,7 +79,7 @@ Historical gain in 2000-01, valued at 2000-02-01:
assets:b || -15 A
assets:old || 2 A
# 7. also works in balancesheet
# ** 7. also works in balancesheet
$ hledger -f- bs -M --gain --no-total
Balance Sheet 1999-12-31..2000-02-29 (Historical Gain), valued at period ends

View File

@ -1,4 +1,6 @@
# 1. nested includes in subdirectories
# * include directive
# ** 1. nested includes in subdirectories
$ mkdir -p b/c/d ; printf '2010/1/1\n (D) 1\n' >b/c/d/d.journal ; printf '2010/1/1\n (C) 1\ninclude d/d.journal\n' >b/c/c.journal ; printf '2010/1/1\n (B) 1\ninclude c/c.journal\n' >b/b.journal ; printf '2010/1/1\n (A) 1\ninclude b/b.journal\n' >a.journal ; hledger -f a.journal print; rm -rf a.journal bG
2010-01-01
(A) 1
@ -14,7 +16,7 @@ $ mkdir -p b/c/d ; printf '2010/1/1\n (D) 1\n' >b/c/d/d.journal ; printf '2010
>= 0
# 2. Including other formats.
# ** 2. Including other formats.
<
2016/1/1
(x) 1
@ -33,7 +35,7 @@ $ hledger -f - print
>=
# 3. include glob patterns
# ** 3. include glob patterns
<
include *b.journal
$ printf '2018/01/01\n (A) 1\n' >ab.journal; printf '2018/01/01\n (B) 1' >bb.journal; hledger -f - print; rm -f ab.journal bb.journal
@ -45,21 +47,21 @@ $ printf '2018/01/01\n (A) 1\n' >ab.journal; printf '2018/01/01\n (B) 1' >bb
>=
# 4. include invalid glob patterns
# ** 4. include invalid glob patterns
<
include [.journal
$ hledger -f - print
>2 //
>= 1
# 5. include nonexsitant file
# ** 5. include nonexsitant file
<
include doesnotexist.journal
$ hledger -f - print
>2 //
>= 1
# 6. include relative to home
# ** 6. include relative to home
<
include ~/included.journal
$ printf '2018/01/01\n (A) 1\n' >included.journal; HOME="$PWD" hledger -f - print; rm -rf included.journal
@ -71,17 +73,17 @@ $ printf '2018/01/01\n (A) 1\n' >included.journal; HOME="$PWD" hledger -f - pr
# The next tests require hard coded file names, so are not concurrent-safe.
# They use different file names so a single concurrent shelltest invocation will be fine.
# 7. test that order of include files is maintained
# ** 7. test that order of include files is maintained
$ printf 'include _b\n' >_a; touch _b; hledger -f _a stats | grep _ | sed -e 's%.*/%%'; rm -rf _a _b
_a
_b
# 8. and with --auto code path
# ** 8. and with --auto code path
$ printf 'include _d\n=\n' >_c; touch _d; hledger -f _c stats --auto | grep _ | sed -e 's%.*/%%'; rm -rf _c _d
_c
_d
# 9. include using old !include directive
# ** 9. include using old !include directive
<
!include f.journal
$ printf '2018/01/01\n (A) 1\n' >f.journal; hledger -f - print; rm -f f.journal

View File

@ -1,4 +1,6 @@
# 1. Simple case
# * number parsing
# ** 1. Simple case
<
2017/1/1
a 1,000.00 EUR
@ -7,7 +9,7 @@ $ hledger bal -f - --no-total
1,000.00 EUR a
-1,000.00 EUR b
# 2. No digits before decimal sep
# ** 2. No digits before decimal sep
<
2017/1/1
a .01 EUR
@ -16,7 +18,7 @@ $ hledger bal -f - --no-total
0.01 EUR a
-0.01 EUR b
# 3. No digits after decimal sep
# ** 3. No digits after decimal sep
<
2017/1/1
a 1. EUR
@ -25,7 +27,7 @@ $ hledger bal -f - --no-total
1 EUR a
-1 EUR b
# 4. No digits at all
# ** 4. No digits at all
<
2017/1/1
a . EUR
@ -34,7 +36,7 @@ $ hledger bal -f -
>2 //
>= 1
# 5. Space between digits groups
# ** 5. Space between digits groups
<
2017/1/1
a 1 000.00 EUR
@ -43,7 +45,7 @@ $ hledger bal -f - --no-total
1 000.00 EUR a
-1 000.00 EUR b
# 6. Space between digits groups in commodity directive
# ** 6. Space between digits groups in commodity directive
<
commodity 1 000.00 EUR
@ -54,7 +56,7 @@ $ hledger bal -f - --no-total
1 000.00 EUR a
-1 000.00 EUR b
# 7. Default commodity
# ** 7. Default commodity
<
D 1,000.00 EUR
@ -67,7 +69,7 @@ $ hledger bal -f -
--------------------
0
# 8. Omitted decimals
# ** 8. Omitted decimals
<
2017/1/1
a 1,000 EUR
@ -76,7 +78,7 @@ $ hledger bal -f -
>2 //
>= 1
# 9. Omitted decimals with commodity hint
# ** 9. Omitted decimals with commodity hint
<
commodity 1,000.00 EUR
@ -89,7 +91,7 @@ $ hledger bal -f -
--------------------
0
# 10. Omitted decimals with commodity hint and symbol on left
# ** 10. Omitted decimals with commodity hint and symbol on left
<
commodity €1,000.00
@ -102,7 +104,7 @@ $ hledger bal -f -
--------------------
0
# 11. Commodity directive requires a decimal separator
# ** 11. Commodity directive requires a decimal separator
<
commodity 1000 EUR
$ hledger bal -f -
@ -110,7 +112,7 @@ $ hledger bal -f -
>2 /Please include a decimal point or decimal comma/
>= 1
# 12. Commodity directive with zero precision
# ** 12. Commodity directive with zero precision
<
commodity 100. EUR
@ -123,7 +125,7 @@ $ hledger bal -f -
--------------------
0
# 13. Big prices
# ** 13. Big prices
<
2017/1/1
a -1 BTC @ 24,840 UAH
@ -132,7 +134,7 @@ $ hledger bal -f - --no-total
>2 //
>= 1
# 14. Big prices with commodity hint
# ** 14. Big prices with commodity hint
<
commodity ₴1,000.00
@ -143,7 +145,7 @@ $ hledger bal -f - --no-total
-1 BTC a
₴24,840.00 b
# 15. adjacent punctuation chars
# ** 15. adjacent punctuation chars
<
2017/1/1
a 1,,0,,0.0 EUR
@ -152,7 +154,7 @@ $ hledger bal -f -
>2 //
>= 1
# 16. adjacent punctuation chars of different types
# ** 16. adjacent punctuation chars of different types
<
2017/1/1
a 1,0,.0 EUR
@ -161,7 +163,7 @@ $ hledger bal -f -
>2 //
>= 1
# 17. separator chars vary
# ** 17. separator chars vary
<
2017/1/1
a 1.0,0.0,0 EUR
@ -170,7 +172,7 @@ $ hledger bal -f -
>2 //
>= 1
# 18. number begins with a decimal char
# ** 18. number begins with a decimal char
<
2017/1/1
a .1 EUR
@ -181,7 +183,7 @@ $ hledger bal -f -
--------------------
0
# 19. number begins with a separator char
# ** 19. number begins with a separator char
<
2017/1/1
a ,100.0 EUR
@ -190,7 +192,7 @@ $ hledger bal -f -
>2 //
>= 1
# 20. long numbers in multi balance reports
# ** 20. long numbers in multi balance reports
<
2021-01-01
(a) -0.12345678901234567890123456 EUR

View File

@ -1,6 +1,6 @@
# Tests for parentheses and brackets in account names
# * account names with parentheses and brackets
# 1. Parentheses in the middle of an account name are ignored.
# ** 1. Parentheses in the middle of an account name are ignored.
<
2009-01-01 x
a 2
@ -15,7 +15,7 @@ $ hledger -f - print
>= 0
# 2. Nested parentheses are removed and the outer brackets are used as the type.
# ** 2. Nested parentheses are removed and the outer brackets are used as the type.
<
2023-01-01
[([(a)])] 1

View File

@ -1,11 +1,10 @@
# Testing parse error messages for accuracy and usefulness.
# * parse error messages
# A journal with an incomplete date.
# ** 1. A journal with an incomplete date.
# XXX depends on the executable being named "hledger" (prepended by GHC.Err.error)
<
2018
# XXX depends on the executable being named "hledger" (prepended by GHC.Err.error)
# 1.
$ hledger -f - print
>2
hledger: Error: -:1:5:
@ -22,14 +21,14 @@ expecting date separator or digit
2009/1/1
a 1
# 2. When read from stdin with no reader prefix, the journal reader is used
# ** 2. When read from stdin with no reader prefix, the journal reader is used
# (before 1.17, all readers were tried and the timedot reader would succeed),
# giving an unbalanced error in this case.
$ hledger -f - print
>2 /real postings' sum should be 0 but is: 1/
>=1
# 3. We expect to have reference to line number with last posting
# ** 3. We expect to have reference to line number with last posting
# NB: \< and \> match start and end of a word.
$ hledger -f journal:- print
>2 /\<2\>/
@ -40,7 +39,7 @@ $ hledger -f journal:- print
2018/1/1
(a) 1
# 4. hledger doesn't detect this as an error directly, it parses account name "(a) 1" and
# ** 4. hledger doesn't detect this as an error directly, it parses account name "(a) 1" and
# amount 0 here.
$ hledger -f - print -x
2018-01-01
@ -48,7 +47,7 @@ $ hledger -f - print -x
>=
# 5. Two (or more) postings with implicit amount cannot be balanced.
# ** 5. Two (or more) postings with implicit amount cannot be balanced.
<
2018/1/1
a 1
@ -59,7 +58,7 @@ $ hledger -f journal:- print
>2 /can't be more than one real posting with no amount/
>=1
# 6. Two (or more) virtual postings with implicit amount cannot be balanced.
# ** 6. Two (or more) virtual postings with implicit amount cannot be balanced.
# (And the error message contains line numbers).
<
2018/1/1
@ -71,7 +70,7 @@ $ hledger -f journal:- print
>2 /:1-4/
>=1
# 7. Balancing error messages show the recorded precision, not the display precision.
# ** 7. Balancing error messages show the recorded precision, not the display precision.
<
2010/1/1
a 1C @ $1.0049
@ -80,7 +79,7 @@ $ hledger -f- print
>2 /real postings' sum should be 0 but is: \$0.0049/
>=1
# 8. Multiple postings all with the same sign gets a distinct error message.
# ** 8. Multiple postings all with the same sign gets a distinct error message.
<
2020-01-01
a 1A
@ -89,7 +88,7 @@ $ hledger -f- print
>2 /real postings all have the same sign/
>=1
# 9. Zeros don't trigger the same sign error.
# ** 9. Zeros don't trigger the same sign error.
<
2020-01-01
a A 0
@ -101,7 +100,7 @@ $ hledger -f- print
>=0
# 10. An inferred multicommodity amount doesn't trigger the same sign error.
# ** 10. An inferred multicommodity amount doesn't trigger the same sign error.
<
2020-01-01
a A 1
@ -115,12 +114,13 @@ $ hledger -f- print
>=0
# 11. For multiple postings all with the same sign but in different commodities,
# ** 11. For multiple postings all with the same sign but in different commodities,
# the error should show the original amounts, without inferring transaction prices.
<
2020-01-01
a 1A
b 1B
$ hledger -f- print
>2
hledger: Error: -:1-3:
@ -133,8 +133,9 @@ The real postings all have the same sign. Consider negating some of them.
Consider adjusting this entry's amounts, adding missing postings,
or recording conversion price(s) with @, @@ or equity postings.
>=1
#'
# 12. Typical "hledger equity --close" transaction does not trigger sign error.
# ** 12. Typical "hledger equity --close" transaction does not trigger sign error.
<
2019-01-01 opening balances
assets:a1 $3
@ -158,7 +159,7 @@ $ hledger -f- print
>=0
# 13. Adding a multiplier in a normal posting gives a parse error.
# ** 13. Adding a multiplier in a normal posting gives a parse error.
<
2020-01-01
(a) *1

View File

@ -1,4 +1,6 @@
# 1. posting dates can be set with a tag. Also the year can be
# * posting dates
# ** 1. posting dates can be set with a tag. Also the year can be
# inferred from the transaction. If there are multiple tags, the first
# is used. Date separators /-. are allowed.
<
@ -7,7 +9,7 @@
$ hledger -f- register
> /^2000-03-04/
# 2. If the date: or date2: tags do not have a valid simple date
# ** 2. If the date: or date2: tags do not have a valid simple date
# value, there should be a corresponding error at the right position
<
comment
@ -25,7 +27,7 @@ $ hledger -f- register
>2 /10:16/
>= 1
# 3. Ledger's bracketed date syntax is also supported: `[DATE]`,
# ** 3. Ledger's bracketed date syntax is also supported: `[DATE]`,
# `[DATE=DATE2]` or `[=DATE2]`. This is equivalent to using `date:` or
# `date2:` tags.
<
@ -34,7 +36,7 @@ $ hledger -f- register
$ hledger -f- register --date2
> /^2000-03-04/
# 4. Date parsing and error reporting activates for square brackets
# ** 4. Date parsing and error reporting activates for square brackets
# containing only `0123456789/-.=` characters.
<
comment
@ -51,7 +53,7 @@ $ hledger -f- register
>2 /-:9:21/
>= 1
# 5. In this example, the second posting's later date causes the third posting to be processed
# ** 5. In this example, the second posting's later date causes the third posting to be processed
# before it, inferring a -1 amount, causing this transaction to be considered unbalanced. (#2025)
<
2023-01-01

View File

@ -1,6 +1,8 @@
# * decimal precision, balancing and display
# http://code.google.com/p/hledger/issues/detail?id=23
#
# 1. original test case, this should balance since price precisions do
# ** 1. original test case, this should balance since price precisions do
# not affect the canonical display precisions used for display and balancing
<
2010/1/1 x
@ -13,7 +15,7 @@ $ hledger -f - print
>= 0
# 2. here the price should be printed with its original precision, not
# ** 2. here the price should be printed with its original precision, not
# the canonical display precision. And the inferred amount should be printed
# with the canonical precision (2 digits, inferred from the first posting).
<
@ -29,7 +31,7 @@ $ hledger -f - print --explicit
>= 0
# 3. with $'s display precision at 3 or more, this txn should not balance.
# ** 3. with $'s display precision at 3 or more, this txn should not balance.
# The error message shows the difference with full precision.
<
2010/1/1
@ -39,7 +41,7 @@ $ hledger -f - balance --no-total --cost --empty
>2 /should be 0 but is: \$0.0049/
>= 1
# 4. with $'s display precision at 2 or less, this txn should balance
# ** 4. with $'s display precision at 2 or less, this txn should balance
<
2010/1/1
a 1C @ $1.0049
@ -47,7 +49,7 @@ $ hledger -f - balance --no-total --cost --empty
$ hledger -f - balance --no-total --cost --empty
0 a
# 5. avamk's 2011/1/19 example
# ** 5. avamk's 2011/1/19 example
<
2001/01/01 * ACME fund
assets:investment:ACME 203.890 ACME @ $16.02
@ -102,7 +104,7 @@ $ hledger -f - balance --cost
### 0
#
# 7. when there are multiple postings in the commodity being priced,
# ** 7. when there are multiple postings in the commodity being priced,
# show the averaged unit price, with precision equal to the sum of
# the max precisions of the commodities being converted (#262).
# Here the (irrational) price should be displayed with just precision 4
@ -121,7 +123,7 @@ $ hledger -f- print --explicit
>= 0
# 8. Here the price should be displayed with precision 7
# ** 8. Here the price should be displayed with precision 7
# (E's precision 4 + F's precision 3).
<
2015/1/1
@ -136,7 +138,7 @@ $ hledger -f- print --explicit
>= 0
# 9. Posting amounts inferred from balance assignments also affect commodity styles. (#2091)
# ** 9. Posting amounts inferred from balance assignments also affect commodity styles. (#2091)
<
2023-01-01
(a) 1 A

View File

@ -1,4 +1,6 @@
# 1. just check
# * scientific notation number parsing
# ** 1. just check
<
D $1,000.00
@ -7,7 +9,7 @@ D $1,000.00
$ hledger -f - bal --no-total
$2.30 a
# 2. some basic cases with commodity
# ** 2. some basic cases with commodity
<
commodity $1,000.00000000
@ -22,7 +24,7 @@ $ hledger -f - bal --no-total
$1,000.00000000 c
$-1,108.14159260 d
# 3. some basic cases with commodity
# ** 3. some basic cases with commodity
<
commodity $1,000.00000000
@ -40,7 +42,7 @@ $ hledger -f - print --explicit
>=
# 4. some basic cases
# ** 4. some basic cases
<
2018/1/1
a 1.05e2
@ -53,7 +55,7 @@ $ hledger -f - bal --no-total
1000.0000000 c
-1108.1415926 d
# 5. we still should recognize commodities with e
# ** 5. we still should recognize commodities with e
<
2018/1/1
(a) 1.00005e
@ -62,7 +64,7 @@ $ hledger -f - bal --no-total
2.00003E
1.00005e a
# 6.
# ** 6.
<
2018/1/1
(a) 1,000.5e-1

View File

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

View File

@ -1,7 +1,9 @@
# * value and cost reports
# http://hledger.org/journal.html#market-prices
# http://hledger.org/hledger.html#market-value
# 1. Market prices are ignored by -B.
# ** 1. Market prices are ignored by -B.
<
P 2011/01/01 € $1.35
@ -14,7 +16,7 @@ $ hledger -f- bal -NB
€100 expenses:foreign
# 2. Market prices are used by bal -V.
# ** 2. Market prices are used by bal -V.
# Market prices for other commodities are not used.
# Nor are transaction prices.
<
@ -28,7 +30,7 @@ $ hledger -f- bal -N -V
$135.00 expenses:foreign
# 3. The location of price directives does not matter.
# ** 3. The location of price directives does not matter.
# If multiple directives have the same date, the last parsed is used.
<
3000/01/01
@ -45,7 +47,7 @@ $ hledger -f- bal -N -V a
€130.00 a
# 4. Market prices in the future are ignored when the valuation date
# ** 4. Market prices in the future are ignored when the valuation date
# is today. #453, #683
<
P 2000/1/1 $ €1.20
@ -58,7 +60,7 @@ $ hledger -f- bal -N --value=now
€120.00 a
# 5. Market prices in the future are not ignored when they are before
# ** 5. Market prices in the future are not ignored when they are before
# the valuation date set with an explicit report end date, as in
# hledger 1.14 and older, and Ledger. See also valuation2.test, #1083
<
@ -71,7 +73,7 @@ $ hledger -f- bal -N -V -e 3000/2
€110.00 a
# 6. Market prices interact with D directives and with amount style canonicalisation. #131
# ** 6. Market prices interact with D directives and with amount style canonicalisation. #131
<
D 1000.00 H ; declare a default commodity named H
@ -93,7 +95,7 @@ $ hledger -f- balance -V
0.48 H
# 7. register -V affects posting amounts and total.
# ** 7. register -V affects posting amounts and total.
<
P 2000/1/1 $ €1.20
2000/1/1
@ -103,7 +105,7 @@ $ hledger -f- reg -V
2000-01-01 (a) €120.00 €120.00
# 8. print -V affects posting amounts but not balance assertions.
# ** 8. print -V affects posting amounts but not balance assertions.
<
P 2000/1/1 $ €1.20
2000/1/1
@ -135,7 +137,7 @@ P 2000/04/01 A 4 B
# print
# 9. print costs using transaction prices
# ** 9. print costs using transaction prices
$ hledger -f- print --value=cost
2000-01-01
(a) 6 B
@ -148,7 +150,7 @@ $ hledger -f- print --value=cost
>=0
# 10. print value using market prices on each transaction's (posting's) date
# ** 10. print value using market prices on each transaction's (posting's) date
$ hledger -f- print --value=then
2000-01-01
(a) 1 B
@ -161,7 +163,7 @@ $ hledger -f- print --value=then
>=0
# 11. print value using prices on last day of report period (2000-02-29)
# ** 11. print value using prices on last day of report period (2000-02-29)
$ hledger -f- print --value=end date:2000/01-2000/03
2000-01-01
(a) 2 B
@ -171,7 +173,7 @@ $ hledger -f- print --value=end date:2000/01-2000/03
>=0
# 12. print value using prices on last day of report period (no period specified)
# ** 12. print value using prices on last day of report period (no period specified)
# specified - uses last day of journal, noting that price directives are included (2000-04-01)
$ hledger -f- print --value=end
2000-01-01
@ -185,7 +187,7 @@ $ hledger -f- print --value=end
>=0
# 13. print value using prices on a specified date
# ** 13. print value using prices on a specified date
$ hledger -f- print --value=2000-01-15
2000-01-01
(a) 5 B
@ -198,7 +200,7 @@ $ hledger -f- print --value=2000-01-15
>=0
# 14. print value using prices today
# ** 14. print value using prices today
# (assuming today's date is >= 2000-04-01)
$ hledger -f- print --value=now
2000-01-01
@ -214,37 +216,37 @@ $ hledger -f- print --value=now
# register
# 15. register report valued at cost.
# ** 15. register report valued at cost.
$ hledger -f- reg --value=cost
2000-01-01 (a) 6 B 6 B
2000-02-01 (a) 7 B 13 B
2000-03-01 (a) 8 B 21 B
# 16. register report valued at posting dates
# ** 16. register report valued at posting dates
$ hledger -f- reg --value=then
2000-01-01 (a) 1 B 1 B
2000-02-01 (a) 2 B 3 B
2000-03-01 (a) 3 B 6 B
# 17. register report valued at period end (including price directives)
# ** 17. register report valued at period end (including price directives)
$ hledger -f- reg --value=end
2000-01-01 (a) 4 B 4 B
2000-02-01 (a) 4 B 8 B
2000-03-01 (a) 4 B 12 B
# 18. register report valued at specified date
# ** 18. register report valued at specified date
$ hledger -f- reg --value=2000-01-15
2000-01-01 (a) 5 B 5 B
2000-02-01 (a) 5 B 10 B
2000-03-01 (a) 5 B 15 B
# 19. register report valued today
# ** 19. register report valued today
$ hledger -f- reg --value=now
2000-01-01 (a) 4 B 4 B
2000-02-01 (a) 4 B 8 B
2000-03-01 (a) 4 B 12 B
# 20. single-period register report valued at default date (same as --value=now)
# ** 20. single-period register report valued at default date (same as --value=now)
$ hledger -f- reg -V
2000-01-01 (a) 4 B 4 B
2000-02-01 (a) 4 B 8 B
@ -252,17 +254,17 @@ $ hledger -f- reg -V
# register with -H (starting balance)
# 21. register with starting balance, unvalued (See issue #1522).
# ** 21. register with starting balance, unvalued (See issue #1522).
$ hledger -f- reg -b 200002 -H
2000-02-01 (a) 1 A 2 A
2000-03-01 (a) 1 A 3 A
# 22. register with starting balance, valued at cost.
# ** 22. register with starting balance, valued at cost.
$ hledger -f- reg --value=cost -b 200002 -H
2000-02-01 (a) 7 B 13 B
2000-03-01 (a) 8 B 21 B
# 23. register with starting balance, valued at period end.
# ** 23. register with starting balance, valued at period end.
# That is unspecified so the last posting date (or price directive date) is used,
# ie 2000/4/1, so the price is 4 B.
# Starting balance is 1 A, which is valued at 4 B.
@ -270,7 +272,7 @@ $ hledger -f- reg --value=end -b 200002 -H
2000-02-01 (a) 4 B 8 B
2000-03-01 (a) 4 B 12 B
# 24. register with starting balance, valued at specified date (when the price is 5 B).
# ** 24. register with starting balance, valued at specified date (when the price is 5 B).
# Starting balance is 5 B as above.
$ hledger -f- reg --value=2000-01-15 -b 200002 -H
2000-02-01 (a) 5 B 10 B
@ -278,7 +280,7 @@ $ hledger -f- reg --value=2000-01-15 -b 200002 -H
# register, periodic
# 25. periodic register report valued at cost.
# ** 25. periodic register report valued at cost.
# The total for january is 6 B (1 A valued at 1/1, price 1 B, and 1 A
# valued at 1/20, price 5 B).
# Need an extra transaction for this test:
@ -324,25 +326,25 @@ P 2000/04/01 B 1 C
2000/03/01
(a) 1 A @ 8 B
# 26. periodic register report valued at period end
# ** 26. periodic register report valued at period end
$ hledger -f- reg --value=end -M -b 2000
2000-01 a 5 B 5 B
2000-02 a 2 B 7 B
2000-03 a 3 B 10 B
# 27. periodic register report valued at specified date
# ** 27. periodic register report valued at specified date
$ hledger -f- reg --value=2000-01-15 -M -b 2000
2000-01 a 5 B 5 B
2000-02 a 5 B 10 B
2000-03 a 5 B 15 B
# 28. periodic register report valued today
# ** 28. periodic register report valued today
$ hledger -f- reg --value=now -M -b 2000
2000-01 a 4 B 4 B
2000-02 a 4 B 8 B
2000-03 a 4 B 12 B
# 29. periodic register report valued at default date (same as --value=end)
# ** 29. periodic register report valued at default date (same as --value=end)
$ hledger -f- reg -V -M -b 2000
2000-01 a 5 B 5 B
2000-02 a 2 B 7 B
@ -350,30 +352,30 @@ $ hledger -f- reg -V -M -b 2000
# balance
# 30. single column balance report valued at cost
# ** 30. single column balance report valued at cost
$ hledger -f- bal -N --value=cost -b 2000
15 B
6 C a
# 31. single column balance report valued at period end (which includes market price declarations, see #1405)
# ** 31. single column balance report valued at period end (which includes market price declarations, see #1405)
$ hledger -f- bal -N --value=end -b 2000
12 B a
# 32. single column balance report valued at specified date
# ** 32. single column balance report valued at specified date
$ hledger -f- bal -N --value=2000-01-15 -b 2000
15 B a
# 33. single column balance report valued today
# ** 33. single column balance report valued today
$ hledger -f- bal -N --value=now -b 2000
12 B a
# 34. single column balance report converted to cost and then valued at end
# ** 34. single column balance report converted to cost and then valued at end
$ hledger -f- bal -N --cost --value=end -b 2000
21 C a
# balance, periodic
# 35. multicolumn balance report valued at cost
# ** 35. multicolumn balance report valued at cost
$ hledger -f- bal -MTA --value=cost -b 2000
Balance changes in 2000Q1, converted to cost:
@ -383,7 +385,7 @@ Balance changes in 2000Q1, converted to cost:
---++------------------------------------
|| 6 C 7 B 8 B 15 B, 6 C 5 B, 2 C
# 36. multicolumn balance report valued at posting date
# ** 36. multicolumn balance report valued at posting date
$ hledger -f- bal -M --value=then -b 2000
Balance changes in 2000Q1, valued at posting date:
@ -393,7 +395,7 @@ Balance changes in 2000Q1, valued at posting date:
---++---------------
|| 1 B 2 B 3 B
# 37. multicolumn balance report showing changes in period-end values with -T or -A
# ** 37. multicolumn balance report showing changes in period-end values with -T or -A
$ hledger -f- bal -MTA --value=end -b 2000
Balance changes in 2000-01-01..2000-04-30, valued at period ends:
@ -403,7 +405,7 @@ Balance changes in 2000-01-01..2000-04-30, valued at period ends:
---++--------------------------------------
|| 5 B 2 B 3 B 0 10 B 2 B
# 38. multicolumn balance report valued at other date
# ** 38. multicolumn balance report valued at other date
$ hledger -f- bal -MTA --value=2000-01-15 -b 2000
Balance changes in 2000Q1, valued at 2000-01-15:
@ -413,7 +415,7 @@ Balance changes in 2000Q1, valued at 2000-01-15:
---++---------------------------------
|| 5 B 5 B 5 B 15 B 5 B
# 39. multicolumn balance report valued today (with today >= 2000-04-01)
# ** 39. multicolumn balance report valued today (with today >= 2000-04-01)
$ hledger -f- bal -M --value=now -b 2000
Balance changes in 2000Q1, current value:
@ -423,7 +425,7 @@ Balance changes in 2000Q1, current value:
---++---------------
|| 4 B 4 B 4 B
# 40. multicolumn balance report showing changes in period-end values (same as --value=end)
# ** 40. multicolumn balance report showing changes in period-end values (same as --value=end)
$ hledger -f- bal -M -V -b 2000
Balance changes in 2000-01-01..2000-04-30, valued at period ends:
@ -435,7 +437,7 @@ Balance changes in 2000-01-01..2000-04-30, valued at period ends:
# balance, periodic, with -H (starting balance and accumulating across periods)
# 41. multicolumn balance report with -H, valued at cost.
# ** 41. multicolumn balance report with -H, valued at cost.
# The starting balance on 2000/01/01 is 6 C (cost of the first 1 A).
# February adds 1 A costing 7 B, making 7 B, 6 C.
# March adds 1 A costing 8 B, making 15 B, 6 C.
@ -448,7 +450,7 @@ Ending balances (historical) in 2000-02-01..2000-03-31, converted to cost:
---++------------------------
|| 7 B, 6 C 15 B, 6 C
# 42. multicolumn balance report with -H valued at period end.
# ** 42. multicolumn balance report with -H valued at period end.
# The starting balance is 1 A.
# February adds 1 A making 2 A, which is valued at 2000/02/29 as 4 B.
# March adds 1 A making 3 A, which is valued at 2000/03/31 as 9 B.
@ -462,7 +464,7 @@ Ending balances (historical) in 2000-02-01..2000-04-30, valued at period ends:
---++---------------------------------------------
|| 4 B 9 B 12 B 8 B
# 43. multicolumn balance report with -H valued at other date.
# ** 43. multicolumn balance report with -H valued at other date.
# The starting balance is 15 B (3 A valued at 2000/1/15).
$ hledger -f- bal -M -H -b 200002 --value=2000-01-15
Ending balances (historical) in 2000-02-01..2000-03-31, valued at 2000-01-15:
@ -473,7 +475,7 @@ Ending balances (historical) in 2000-02-01..2000-03-31, valued at 2000-01-15:
---++------------------------
|| 10 B 15 B
# 44. multicolumn balance report with -H, valuing each period's carried-over balances at cost.
# ** 44. multicolumn balance report with -H, valuing each period's carried-over balances at cost.
<
P 2000/01/01 A 1 B
P 2000/01/15 A 5 B
@ -493,7 +495,7 @@ Ending balances (historical) in 2000Q1, converted to cost:
---++------------------------------------
|| 6 B 6 B 6 B
# 45. multicolumn balance report with -H, valuing each period's carried-over balances at period end.
# ** 45. multicolumn balance report with -H, valuing each period's carried-over balances at period end.
# Unrelated, also -H always disables -T.
$ hledger -f- bal -META -H -p200001-200004 --value=e
Ending balances (historical) in 2000Q1, valued at period ends:
@ -504,7 +506,7 @@ Ending balances (historical) in 2000Q1, valued at period ends:
---++---------------------------------------------
|| 5 B 2 B 3 B 3 B
# 46. multicolumn balance report with -H, valuing each period's carried-over balances at other date.
# ** 46. multicolumn balance report with -H, valuing each period's carried-over balances at other date.
$ hledger -f- bal -ME -H -p200001-200004 --value=2000-01-15
Ending balances (historical) in 2000Q1, valued at 2000-01-15:
@ -536,7 +538,7 @@ P 2000/04/01 A 4 B
2000/03/01
(a) 1 A @ 8 B
# 47. budget report, unvalued (for reference).
# ** 47. budget report, unvalued (for reference).
$ hledger -f- bal -M --budget
Budget performance in 2000Q1:
@ -546,7 +548,7 @@ Budget performance in 2000Q1:
---++------------------------------------------------------
|| 1 A [50% of 2 A] 1 A [50% of 2 A] 1 A [50% of 2 A]
# 48. budget report, valued at cost.
# ** 48. budget report, valued at cost.
$ hledger -f- bal -MTA --budget --value=c
Budget performance in 2000Q1, converted to cost:
@ -556,7 +558,7 @@ Budget performance in 2000Q1, converted to cost:
---++------------------------------------------------------------------------------------------------
|| 6 B [300% of 2 B] 7 B [350% of 2 B] 8 B [400% of 2 B] 21 B [350% of 6 B] 7 B [350% of 2 B]
# 49. budget report, showing changes in period-end values.
# ** 49. budget report, showing changes in period-end values.
$ hledger -f- bal -MTA --budget --value=e
Budget performance in 2000-01-01..2000-04-30, valued at period ends:
@ -566,7 +568,7 @@ Budget performance in 2000-01-01..2000-04-30, valued at period ends:
---++------------------------------------------------------------------------------------------------------------
|| 5 B [50% of 10 B] 2 B [50% of 4 B] 3 B [50% of 6 B] 0 [0% of 8 B] 10 B [36% of 28 B] 2 B [36% of 7 B]
# 50. budget report, valued at other date.
# ** 50. budget report, valued at other date.
$ hledger -f- bal -MTA --budget --value=2000-01-15
Budget performance in 2000Q1, valued at 2000-01-15:
@ -576,7 +578,7 @@ Budget performance in 2000Q1, valued at 2000-01-15:
---++------------------------------------------------------------------------------------------------
|| 5 B [50% of 10 B] 5 B [50% of 10 B] 5 B [50% of 10 B] 15 B [50% of 30 B] 5 B [50% of 10 B]
# 51. --value=then with --historical. The starting total is valued individually for each posting at its posting time.
# ** 51. --value=then with --historical. The starting total is valued individually for each posting at its posting time.
<
P 2020-01-01 A 1 B
P 2020-02-01 A 2 B
@ -600,7 +602,7 @@ $ hledger -f- reg --value=then -b 2020-03 -H
2020-04-01 (a) 4 B 10 B
>=0
# 52. --value=then with a report interval. Summary amounts are the sums of the
# ** 52. --value=then with a report interval. Summary amounts are the sums of the
# values of each posting at their posting date.
<
P 2020-01-01 A 1 B
@ -625,7 +627,7 @@ $ hledger -f- reg --value=then -Q
2020Q2 a 4 B 10 B
>=0
# 53. print --value should affect all postings, including when there's an implicit transaction price
# ** 53. print --value should affect all postings, including when there's an implicit transaction price
<
P 2020-01-01 A 1 C
P 2020-01-01 B 1 C

View File

@ -1,4 +1,4 @@
# More valuation tests. See also valuation.test.
# * valuation tests, part 2.
; some market prices
P 2019-01-01 B 10 A
@ -15,7 +15,7 @@ P 2019-01-01 E 3 D
; by hledger, as well as shelltest; useful when troubleshooting.
comment
# 1. normal unvalued output
# ** 1. normal unvalued output
$ hledger -f- print -x
2019-06-01
a 1 B
@ -23,7 +23,7 @@ $ hledger -f- print -x
>=
# 2. current market value in default valuation commodity
# ** 2. current market value in default valuation commodity
$ hledger -f- print -x -V
2019-06-01
a 10 A
@ -31,7 +31,7 @@ $ hledger -f- print -x -V
>=
# 3. same as above, but request commodity A explicitly
# ** 3. same as above, but request commodity A explicitly
$ hledger -f- print -x --value=now,A
2019-06-01
a 10 A
@ -39,7 +39,7 @@ $ hledger -f- print -x --value=now,A
>=
# 4. request commodity B - no effect
# ** 4. request commodity B - no effect
$ hledger -f- print -x --value=now,B
2019-06-01
a 1 B
@ -47,7 +47,7 @@ $ hledger -f- print -x --value=now,B
>=
# 5. request commodity we don't have prices for - no effect
# ** 5. request commodity we don't have prices for - no effect
$ hledger -f- print -x --value=now,Z
2019-06-01
a 1 B
@ -55,7 +55,7 @@ $ hledger -f- print -x --value=now,Z
>=
# 6. request commodity C - uses reverse of C->B price.
# ** 6. request commodity C - uses reverse of C->B price.
# There's nothing setting C display style, so the default style is used,
# which shows no decimal digits.
# And because that makes it display as zero, the commodity symbol
@ -76,7 +76,7 @@ $ hledger -f- print -x --value=now,C
#
# >=
# 7. request commodity D - chains B->A, A->D prices
# ** 7. request commodity D - chains B->A, A->D prices
$ hledger -f- print -x --value=now,D
2019-06-01
a 1000 D
@ -84,7 +84,7 @@ $ hledger -f- print -x --value=now,D
>=
# 8. request commodity E - chains B->A, A->D, reverse of D->E prices.
# ** 8. request commodity E - chains B->A, A->D, reverse of D->E prices.
# As with C above, E gets the default display style, with precision 0.
$ hledger -f- print -x --value=now,E
2019-06-01
@ -110,7 +110,7 @@ $ hledger -f- print -x --value=now,E
a -1A @ 1B
b 1B
# 9. Normal print output.
# ** 9. Normal print output.
$ hledger -f- print
2000-01-01
a -1A @ 1B
@ -118,7 +118,7 @@ $ hledger -f- print
>=0
# 10. Valuing in a commodity with no market price has no effect.
# ** 10. Valuing in a commodity with no market price has no effect.
$ hledger -f- print -XZ
2000-01-01
a -1A @ 1B
@ -126,7 +126,7 @@ $ hledger -f- print -XZ
>=0
# 11. -B converts to the transaction price's commodity.
# ** 11. -B converts to the transaction price's commodity.
$ hledger -f- print -B
2000-01-01
a -1B
@ -134,7 +134,7 @@ $ hledger -f- print -B
>=0
# 12. Note the -XZ does not nullify the -B here.
# ** 12. Note the -XZ does not nullify the -B here.
# (-B -XZ is equivalent to --cost --value=end,Z).
$ hledger -f- print -B -XZ
2000-01-01
@ -151,7 +151,7 @@ P 2000/1/1 A 1B
a -1A @ 1B
b 1B
# 13.
# ** 13.
$ hledger -f- print
2000-01-01
a -1A @ 1B
@ -159,7 +159,7 @@ $ hledger -f- print
>=0
# 14.
# ** 14.
$ hledger -f- print -XZ
2000-01-01
a -1A @ 1B
@ -167,7 +167,7 @@ $ hledger -f- print -XZ
>=0
# 15.
# ** 15.
$ hledger -f- print -B
2000-01-01
a -1B
@ -175,7 +175,7 @@ $ hledger -f- print -B
>=0
# 16.
# ** 16.
$ hledger -f- print -B -XA
2000-01-01
a -1A
@ -191,19 +191,19 @@ P 2002/01/01 A 3 B
2000/01/01
(a) 1 A
# 17. -V uses today as the default valuation date, unlike --value=end.
# ** 17. -V uses today as the default valuation date, unlike --value=end.
$ hledger -f- reg -V
2000-01-01 (a) 3 B 3 B
# 18. -V uses the report end date, if specified, as valuation date.
# ** 18. -V uses the report end date, if specified, as valuation date.
$ hledger -f- reg -V -e 2001
2000-01-01 (a) 2 B 2 B
# 19. In balance reports too.
# ** 19. In balance reports too.
$ hledger -f- bal -N -V
3 B a
# 20.
# ** 20.
$ hledger -f- bal -N -V -e 2001
2 B a
@ -215,7 +215,7 @@ P 2002/01/01 A 2 B
2000-01-01
(a) 1 A
# 21. The valuation date is the last day of the report period. In
# ** 21. The valuation date is the last day of the report period. In
# other words, the report end date is exclusive with respect to price
# directives. This is a change from older hledger and Ledger, where it
# was inclusive.
@ -224,7 +224,7 @@ $ hledger -f- bal -N -V -e 2002-01-01
# Test market prices inferred from transactions.
# 22. Market price is not inferred from transactions by default.
# ** 22. Market price is not inferred from transactions by default.
<
2020-01-01
(a) 1 A @ 2 B
@ -232,12 +232,12 @@ $ hledger -f- bal -N -V -e 2002-01-01
$ hledger -f- bal -N -V
1 A a
# 23. Market price is inferred from transactions with --infer-market-prices,
# ** 23. Market price is inferred from transactions with --infer-market-prices,
# and -V can work with no P directives.
$ hledger -f- bal -N -V --infer-market-prices
B2 a
# 24. A P-declared market price on the same date as a transaction price has precedence.
# ** 24. A P-declared market price on the same date as a transaction price has precedence.
<
P 2020-01-01 A 1 B
@ -247,7 +247,7 @@ P 2020-01-01 A 1 B
$ hledger -f- bal -N -V --infer-market-prices
1 B a
# 25. A transaction-inferred price newer than a P-declared price has precedence.
# ** 25. A transaction-inferred price newer than a P-declared price has precedence.
<
P 2020-01-01 A 1 B
@ -257,7 +257,7 @@ P 2020-01-01 A 1 B
$ hledger -f- bal -N -V --infer-market-prices
2 B a
# 26. A later-dated P directive sets the valuation commodity even if parsed out of order.
# ** 26. A later-dated P directive sets the valuation commodity even if parsed out of order.
<
P 2020-02-01 A 1 C
P 2020-01-01 A 1 B
@ -268,7 +268,7 @@ P 2020-01-01 A 1 B
$ hledger -f- bal -N -V
1 C a
# 27. A later-dated transaction price sets the valuation commodity even if parsed out of order.
# ** 27. A later-dated transaction price sets the valuation commodity even if parsed out of order.
<
2020-01-01
(a) 1 A @ 1 C ; date: 2020-01-02
@ -278,7 +278,7 @@ $ hledger -f- bal -N -V
$ hledger -f- bal -N -V --infer-market-prices
D3 a
# 28. #1402 It should pick the direct (forward) A 3.00 price for B here,
# ** 28. #1402 It should pick the direct (forward) A 3.00 price for B here,
# not the reverse price.
<
2020-11-10
@ -290,7 +290,7 @@ P 2020-11-02 A B 0.40
$ hledger -f- bal -N -e 2020-11-20 -X A
A 3.00 a
# 29. #1402 It should pick the direct B->A price here, not the indirect B->C->A price.
# ** 29. #1402 It should pick the direct B->A price here, not the indirect B->C->A price.
<
2020-11-10
(a) B 1.00
@ -302,7 +302,7 @@ P 2020-11-03 B A 5
$ hledger -f- bal -N -e 2020-11-20 -X A
A 5 a
# 30. #1439 Lots of price edges like the below should not cause any slowdown.
# ** 30. #1439 Lots of price edges like the below should not cause any slowdown.
<
2020-01-01
(a) 1A
@ -325,7 +325,7 @@ P 2020-01-01 M 140Y
$ hledger -f- bal -N -X Z
Z1 a
# 31. #1443 It should always pick the shortest price path, A>P>Z here.
# ** 31. #1443 It should always pick the shortest price path, A>P>Z here.
<
2020-01-01
(a) 1A
@ -341,7 +341,7 @@ P 2020-01-01 P 100Z
$ hledger -f- bal -N -X Z
100Z a
# 32. #1851 It should use posting date 2 if requested.
# ** 32. #1851 It should use posting date 2 if requested.
<
2019-12-31 FOO
Assets:A $1.00

Some files were not shown because too many files have changed in this diff Show More