mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-27 12:24:43 +03:00
test cleanup
This commit is contained in:
parent
86b510917d
commit
10263ac6d9
21
Tests.hs
21
Tests.hs
@ -87,17 +87,10 @@ misc_tests = TestList [
|
||||
assertparseequal (Mixed [Amount (Commodity {symbol="$",side=L,spaced=False,comma=False,precision=0}) 1 Nothing]) (parsewith transactionamount " $1.")
|
||||
,
|
||||
"canonicaliseAmounts" ~: do
|
||||
let l = canonicaliseAmounts $ rawLedgerWithAmounts ["1","2.00"]
|
||||
assertequal [2,2] (rawLedgerPrecisions l) -- use greatest precision everywhere
|
||||
-- all amounts use the greatest precision
|
||||
assertequal [2,2] (rawLedgerPrecisions $ canonicaliseAmounts $ rawLedgerWithAmounts ["1","2.00"])
|
||||
|
||||
] where
|
||||
rawLedgerWithAmounts as =
|
||||
RawLedger
|
||||
[]
|
||||
[]
|
||||
[nullentry{etransactions=[nullrawtxn{tamount=parse a}]} | a <- as]
|
||||
""
|
||||
where parse = fromparse . parsewith transactionamount . (" "++)
|
||||
]
|
||||
|
||||
balancereportacctnames_tests = TestList
|
||||
[
|
||||
@ -600,3 +593,11 @@ tlistconcat = foldr (\(TestList as) (TestList bs) -> TestList (as ++ bs)) (TestL
|
||||
assertparseequal :: (Show a, Eq a) => a -> (Either ParseError a) -> Assertion
|
||||
assertparseequal expected parsed = either printParseError (assertequal expected) parsed
|
||||
|
||||
rawLedgerWithAmounts as =
|
||||
RawLedger
|
||||
[]
|
||||
[]
|
||||
[nullentry{edescription=a,etransactions=[nullrawtxn{tamount=parse a}]} | a <- as]
|
||||
""
|
||||
where parse = fromparse . parsewith transactionamount . (" "++)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user