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,
|
||||
nullamt,
|
||||
missingamt,
|
||||
amt,
|
||||
num,
|
||||
usd,
|
||||
eur,
|
||||
gbp,
|
||||
@ -131,7 +131,7 @@ amount = Amount{acommodity="", aquantity=0, aprice=NoPrice, astyle=amountstyle}
|
||||
nullamt = amount
|
||||
|
||||
-- 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}}
|
||||
eur 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
|
||||
(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
|
||||
] ""))
|
||||
|
||||
|
||||
@ -922,7 +922,7 @@ tests_Hledger_Read_JournalReader = TestList $ concat [
|
||||
assertAmountParse parseresult amount =
|
||||
(either (const "parse error") showAmountDebug parseresult) ~?= (showAmountDebug amount)
|
||||
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