rename the commodityless amount constructor to num
This commit is contained in:
parent
45d4a38cc7
commit
1c6a7d8a6f
@ -46,7 +46,7 @@ module Hledger.Data.Amount (
|
|||||||
amount,
|
amount,
|
||||||
nullamt,
|
nullamt,
|
||||||
missingamt,
|
missingamt,
|
||||||
amt,
|
num,
|
||||||
usd,
|
usd,
|
||||||
eur,
|
eur,
|
||||||
gbp,
|
gbp,
|
||||||
@ -131,7 +131,7 @@ amount = Amount{acommodity="", aquantity=0, aprice=NoPrice, astyle=amountstyle}
|
|||||||
nullamt = amount
|
nullamt = amount
|
||||||
|
|
||||||
-- handy amount constructors for tests
|
-- handy amount constructors for tests
|
||||||
amt n = amount{acommodity="", aquantity=n}
|
num n = amount{acommodity="", aquantity=n}
|
||||||
usd n = amount{acommodity="$", aquantity=n, astyle=amountstyle{asprecision=2}}
|
usd n = amount{acommodity="$", aquantity=n, astyle=amountstyle{asprecision=2}}
|
||||||
eur n = amount{acommodity="€", aquantity=n, astyle=amountstyle{asprecision=2}}
|
eur n = amount{acommodity="€", aquantity=n, astyle=amountstyle{asprecision=2}}
|
||||||
gbp n = amount{acommodity="£", aquantity=n, astyle=amountstyle{asprecision=2}}
|
gbp n = amount{acommodity="£", aquantity=n, astyle=amountstyle{asprecision=2}}
|
||||||
|
|||||||
@ -444,7 +444,7 @@ tests_Hledger_Data_Transaction = TestList $ concat [
|
|||||||
])
|
])
|
||||||
(showTransaction
|
(showTransaction
|
||||||
(txnTieKnot $ Transaction (parsedate "2010/01/01") Nothing False "" "x" "" []
|
(txnTieKnot $ Transaction (parsedate "2010/01/01") Nothing False "" "x" "" []
|
||||||
[Posting False "a" (Mixed [amt 1 `at` (usd 2 `withPrecision` 0)]) "" RegularPosting [] Nothing
|
[Posting False "a" (Mixed [num 1 `at` (usd 2 `withPrecision` 0)]) "" RegularPosting [] Nothing
|
||||||
,Posting False "b" missingmixedamt "" RegularPosting [] Nothing
|
,Posting False "b" missingmixedamt "" RegularPosting [] Nothing
|
||||||
] ""))
|
] ""))
|
||||||
|
|
||||||
|
|||||||
@ -922,7 +922,7 @@ tests_Hledger_Read_JournalReader = TestList $ concat [
|
|||||||
assertAmountParse parseresult amount =
|
assertAmountParse parseresult amount =
|
||||||
(either (const "parse error") showAmountDebug parseresult) ~?= (showAmountDebug amount)
|
(either (const "parse error") showAmountDebug parseresult) ~?= (showAmountDebug amount)
|
||||||
assertAmountParse (parseWithCtx nullctx amountp "1 @ $2")
|
assertAmountParse (parseWithCtx nullctx amountp "1 @ $2")
|
||||||
(amt 1 `withPrecision` 0 `at` (usd 2 `withPrecision` 0))
|
(num 1 `withPrecision` 0 `at` (usd 2 `withPrecision` 0))
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user