From c8a03999b41ca75a144c4b15dfa7e1c471acff3c Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 1 Apr 2009 09:18:31 +0000 Subject: [PATCH] test cleanup --- Tests.hs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Tests.hs b/Tests.hs index 64d9dab4a..ce699a434 100644 --- a/Tests.hs +++ b/Tests.hs @@ -259,9 +259,6 @@ tests = [ ] ,"balanceEntry" ~: do - let fromeither (Left err) = error err - fromeither (Right e) = e - (tamount $ last $ etransactions $ fromeither $ balanceEntry entry1) `is` Mixed [dollars (-47.18)] assertBool "detect unbalanced entry, sign error" (isLeft $ balanceEntry (Entry (parsedate "2007/01/28") False "" "test" "" @@ -274,12 +271,16 @@ tests = [ [RawTransaction False "a" missingamt "" RegularTransaction, RawTransaction False "b" missingamt "" RegularTransaction ] "")) - assertBool "one missing amount should be ok" - (isRight $ balanceEntry - (Entry (parsedate "2007/01/28") False "" "test" "" - [RawTransaction False "a" (Mixed [dollars 1]) "" RegularTransaction, - RawTransaction False "b" missingamt "" RegularTransaction - ] "")) + let e = balanceEntry (Entry (parsedate "2007/01/28") False "" "test" "" + [RawTransaction False "a" (Mixed [dollars 1]) "" RegularTransaction, + RawTransaction False "b" missingamt "" RegularTransaction + ] "") + assertBool "one missing amount should be ok" (isRight e) + assertEqual "balancing amount is added" + (Mixed [dollars (-1)]) + (case e of + Right e' -> (tamount $ last $ etransactions e') + Left _ -> error "should not happen") ,"balancereportacctnames" ~: let gives (opt,pats) e = do