diff options
author | Daraul Harris <thurst306@gmail.com> | 2020-12-05 14:43:21 +0800 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2020-12-05 15:14:13 +0800 |
commit | 051e4ab1ef82c58dc9563281ec14c02fc250e20f (patch) | |
tree | 868160d22df0adeac9ee0e2462ccae1543009d34 /test | |
parent | 94b692a9bcfccf7d60c85321bd7e358956fdf6e4 (diff) | |
download | fork-ledger-051e4ab1ef82c58dc9563281ec14c02fc250e20f.tar.gz fork-ledger-051e4ab1ef82c58dc9563281ec14c02fc250e20f.tar.bz2 fork-ledger-051e4ab1ef82c58dc9563281ec14c02fc250e20f.zip |
Do not treat balance assignments with 0 diff as a null posting
Ledger is treating balance assignments that have a 0 diff as having
a null posting, leading to the posting being auto-balanced and
therefore causing incorrect values to be returned for the transaction.
I fixed this by just making the posting equal to amt - amt (0 in the
right commodity).
Fixes #1942
Diffstat (limited to 'test')
-rw-r--r-- | test/regress/1942_a.test | 28 | ||||
-rw-r--r-- | test/regress/1942_b.test | 28 | ||||
-rw-r--r-- | test/regress/1942_c.test | 28 | ||||
-rw-r--r-- | test/regress/1942_d.test | 28 |
4 files changed, 112 insertions, 0 deletions
diff --git a/test/regress/1942_a.test b/test/regress/1942_a.test new file mode 100644 index 00000000..4d57f2ba --- /dev/null +++ b/test/regress/1942_a.test @@ -0,0 +1,28 @@ +2018/01/01 * Opening Balance + Assets:Checking $1000.00 + Equity:Opening Balances -$1000.00 + +2018/01/01 * Budget + [Assets:Budget:Rent] $100.00 + [Assets:Budget:Emergency] $200.00 + [Assets:Checking] -$300.00 + +2018/01/01 * Budget + [Assets:Budget:Rent] = $100.00 + [Assets:Budget:Emergency] = $400.00 + [Assets:Bank] -$500.00 + +test bal Assets -> 1 +__ERROR__ +While parsing file "$FILE", line 13: +While balancing transaction from "$FILE", lines 10-13: +> 2018/01/01 * Budget +> [Assets:Budget:Rent] = $100.00 +> [Assets:Budget:Emergency] = $400.00 +> [Assets:Bank] -$500.00 +Unbalanced remainder is: + $-300.00 +Amount to balance against: + $200.00 +Error: Transaction does not balance +end test diff --git a/test/regress/1942_b.test b/test/regress/1942_b.test new file mode 100644 index 00000000..03dd71a3 --- /dev/null +++ b/test/regress/1942_b.test @@ -0,0 +1,28 @@ +2018/01/01 * Opening Balance + Assets:Checking $1000.00 + Equity:Opening Balances -$1000.00 + +2018/01/01 * Budget + [Assets:Budget:Rent] $100.00 + [Assets:Budget:Emergency] $200.00 + [Assets:Checking] -$300.00 + +2018/01/01 * Budget + [Assets:Budget:Rent] $0 = $100.00 + [Assets:Budget:Emergency] = $400.00 + [Assets:Bank] -$500.00 + +test bal Assets -> 1 +__ERROR__ +While parsing file "$FILE", line 13: +While balancing transaction from "$FILE", lines 10-13: +> 2018/01/01 * Budget +> [Assets:Budget:Rent] $0 = $100.00 +> [Assets:Budget:Emergency] = $400.00 +> [Assets:Bank] -$500.00 +Unbalanced remainder is: + $-300.00 +Amount to balance against: + $200.00 +Error: Transaction does not balance +end test diff --git a/test/regress/1942_c.test b/test/regress/1942_c.test new file mode 100644 index 00000000..a36099bd --- /dev/null +++ b/test/regress/1942_c.test @@ -0,0 +1,28 @@ +2018/01/01 * Opening Balance + Assets:Checking $1000.00 + Equity:Opening Balances -$1000.00 + +2018/01/01 * Budget + Assets:Budget:Rent $100.00 + Assets:Budget:Emergency $200.00 + Assets:Checking -$300.00 + +2018/01/01 * Budget + Assets:Budget:Rent = $100.00 + Assets:Budget:Emergency = $400.00 + Assets:Bank -$500.00 + +test bal Assets -> 1 +__ERROR__ +While parsing file "$FILE", line 13: +While balancing transaction from "$FILE", lines 10-13: +> 2018/01/01 * Budget +> Assets:Budget:Rent = $100.00 +> Assets:Budget:Emergency = $400.00 +> Assets:Bank -$500.00 +Unbalanced remainder is: + $-300.00 +Amount to balance against: + $200.00 +Error: Transaction does not balance +end test diff --git a/test/regress/1942_d.test b/test/regress/1942_d.test new file mode 100644 index 00000000..11b40494 --- /dev/null +++ b/test/regress/1942_d.test @@ -0,0 +1,28 @@ +2018/01/01 * Opening Balance + Assets:Checking $1000.00 + Equity:Opening Balances -$1000.00 + +2018/01/01 * Budget + Assets:Budget:Rent $100.00 + Assets:Budget:Emergency $200.00 + Assets:Checking -$300.00 + +2018/01/01 * Budget + Assets:Budget:Rent $0 + Assets:Budget:Emergency = $400.00 + Assets:Bank -$500.00 + +test bal Assets -> 1 +__ERROR__ +While parsing file "$FILE", line 13: +While balancing transaction from "$FILE", lines 10-13: +> 2018/01/01 * Budget +> Assets:Budget:Rent $0 +> Assets:Budget:Emergency = $400.00 +> Assets:Bank -$500.00 +Unbalanced remainder is: + $-300.00 +Amount to balance against: + $200.00 +Error: Transaction does not balance +end test |