lib: test for issue with sign checking code + fix
This commit is contained in:
parent
8b0618ce4d
commit
cbf4029b8b
@ -610,6 +610,7 @@ isNegativeMixedAmount m =
|
||||
[] -> Just False
|
||||
[a] -> Just $ isNegativeAmount a
|
||||
as | all isNegativeAmount as -> Just True
|
||||
as | not (any isNegativeAmount as) -> Just False
|
||||
_ -> Nothing -- multiple amounts with different signs
|
||||
|
||||
-- | Does this mixed amount appear to be zero when rendered with its
|
||||
|
||||
@ -131,3 +131,27 @@ real postings all have the same sign
|
||||
b 1B
|
||||
|
||||
>=1
|
||||
|
||||
# 12. Typical "hledger equity --close" transaction does not trigger sign error.
|
||||
<
|
||||
2019-01-01 opening balances
|
||||
assets:a1 $3
|
||||
assets:a2 £10
|
||||
equity:opening/closing balances
|
||||
|
||||
2019-12-31 closing balances
|
||||
assets:a1 $-3 = $0.00
|
||||
assets:a2 £-10 = £0.00
|
||||
equity:opening/closing balances
|
||||
$ hledger -f- print
|
||||
2019-01-01 opening balances
|
||||
assets:a1 $3
|
||||
assets:a2 £10
|
||||
equity:opening/closing balances
|
||||
|
||||
2019-12-31 closing balances
|
||||
assets:a1 $-3 = $0
|
||||
assets:a2 £-10 = £0
|
||||
equity:opening/closing balances
|
||||
|
||||
>=0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user