diff --git a/Tests.hs b/Tests.hs index 0fa9bca67..75bda68b7 100644 --- a/Tests.hs +++ b/Tests.hs @@ -774,6 +774,7 @@ tests = [ [Posting False "expenses:food:groceries" (Mixed [dollars 47.18]) "" RegularPosting ,Posting False "assets:checking" (Mixed [dollars (-47.18)]) "" RegularPosting ] "")) + -- document some cases that arise in debug/testing: assertEqual "show an unbalanced transaction, should not elide" (unlines ["2007/01/28 coopportunity" @@ -786,6 +787,26 @@ tests = [ [Posting False "expenses:food:groceries" (Mixed [dollars 47.18]) "" RegularPosting ,Posting False "assets:checking" (Mixed [dollars (-47.19)]) "" RegularPosting ] "")) + assertEqual "show an unbalanced transaction with one posting, should not elide" + (unlines + ["2007/01/28 coopportunity" + ," expenses:food:groceries $47.18" + ,"" + ]) + (showLedgerTransaction + (LedgerTransaction (parsedate "2007/01/28") False "" "coopportunity" "" + [Posting False "expenses:food:groceries" (Mixed [dollars 47.18]) "" RegularPosting + ] "")) + assertEqual "show a transaction with one posting and a missing amount" + (unlines + ["2007/01/28 coopportunity" + ," expenses:food:groceries " + ,"" + ]) + (showLedgerTransaction + (LedgerTransaction (parsedate "2007/01/28") False "" "coopportunity" "" + [Posting False "expenses:food:groceries" missingamt "" RegularPosting + ] "")) ,"unicode in balance layout" ~: do l <- ledgerFromStringWithOpts [] [] sampletime