tests: update doctests after Transaction Show change

This commit is contained in:
Simon Michael 2018-09-04 14:02:04 -07:00
parent 7dfd921992
commit d14d6e2b68
2 changed files with 5 additions and 7 deletions

View File

@ -41,7 +41,7 @@ _ptgen str = do
case checkPeriodicTransactionStartDate i s t of case checkPeriodicTransactionStartDate i s t of
Just e -> error' e Just e -> error' e
Nothing -> Nothing ->
mapM_ (putStr . show) $ mapM_ (putStr . showTransaction) $
runPeriodicTransaction runPeriodicTransaction
nullperiodictransaction{ ptperiodexpr=t , ptspan=s, ptinterval=i, ptpostings=["a" `post` usd 1] } nullperiodictransaction{ ptperiodexpr=t , ptspan=s, ptinterval=i, ptpostings=["a" `post` usd 1] }
nulldatespan nulldatespan

View File

@ -38,23 +38,21 @@ import Hledger.Utils.UTF8IOCompat (error')
-- The postings of the transformed transaction will reference it in the usual -- The postings of the transformed transaction will reference it in the usual
-- way (ie, 'txnTieKnot' is called). -- way (ie, 'txnTieKnot' is called).
-- --
-- >>> transactionModifierToFunction (TransactionModifier "" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]} -- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]}
-- 0000/01/01 -- 0000/01/01
-- ping $1.00 -- ping $1.00
-- pong $2.00 -- pong $2.00
-- <BLANKLINE> -- <BLANKLINE>
-- <BLANKLINE> -- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "miss" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]}
-- >>> transactionModifierToFunction (TransactionModifier "miss" ["pong" `post` usd 2]) nulltransaction{tpostings=["ping" `post` usd 1]}
-- 0000/01/01 -- 0000/01/01
-- ping $1.00 -- ping $1.00
-- <BLANKLINE> -- <BLANKLINE>
-- <BLANKLINE> -- >>> putStr $ showTransaction $ transactionModifierToFunction (TransactionModifier "ping" ["pong" `post` amount{amultiplier=True, aquantity=3}]) nulltransaction{tpostings=["ping" `post` usd 2]}
-- >>> transactionModifierToFunction (TransactionModifier "ping" ["pong" `post` amount{amultiplier=True, aquantity=3}]) nulltransaction{tpostings=["ping" `post` usd 2]}
-- 0000/01/01 -- 0000/01/01
-- ping $2.00 -- ping $2.00
-- pong $6.00 -- pong $6.00
-- <BLANKLINE> -- <BLANKLINE>
-- <BLANKLINE> --
transactionModifierToFunction :: TransactionModifier -> (Transaction -> Transaction) transactionModifierToFunction :: TransactionModifier -> (Transaction -> Transaction)
transactionModifierToFunction mt = transactionModifierToFunction mt =
\t@(tpostings -> ps) -> txnTieKnot t{ tpostings=generatePostings ps } -- TODO add modifier txn comment/tags ? \t@(tpostings -> ps) -> txnTieKnot t{ tpostings=generatePostings ps } -- TODO add modifier txn comment/tags ?