From 53b79626588e2eb8aee88833675b533d3cfb3604 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 25 Nov 2009 12:21:59 +0000 Subject: [PATCH] fix all recently-broken tests --- Tests.hs | 40 ++++++++++++------- tests/amountless-virtual-postings.test | 8 ++-- tests/comment-line-after-postings.test | 4 +- tests/commented-posting.test | 4 +- tests/effective-print.test | 4 +- tests/parens-in-account-name.test | 6 +-- tests/print-preserves-comments.test | 2 +- .../unicode-error-message.test.notimplemented | 4 +- tests/unicode-print.test | 4 +- tests/virtual.test | 6 +-- 10 files changed, 47 insertions(+), 35 deletions(-) diff --git a/Tests.hs b/Tests.hs index 446071f05..f84fe8fcf 100644 --- a/Tests.hs +++ b/Tests.hs @@ -668,9 +668,9 @@ tests = [ l <- sampleledgerwithopts [] args showLedgerTransactions [] args l `is` unlines ["2008/06/03 * eat & shop" - ," expenses:food $1" - ," expenses:supplies $1" - ," assets:cash" + ," expenses:food $1" + ," expenses:supplies $1" + ," assets:cash $-2" ,"" ] @@ -679,18 +679,18 @@ tests = [ l <- sampleledger showLedgerTransactions [Depth "2"] [] l `is` unlines ["2008/01/01 income" - ," income:salary $-1" + ," income:salary $-1" ,"" ,"2008/06/01 gift" - ," income:gifts $-1" + ," income:gifts $-1" ,"" ,"2008/06/03 * eat & shop" - ," expenses:food $1" - ," expenses:supplies $1" - ," assets:cash" + ," expenses:food $1" + ," expenses:supplies $1" + ," assets:cash $-2" ,"" ,"2008/12/31 * pay off" - ," liabilities:debts $1" + ," liabilities:debts $1" ,"" ] @@ -832,7 +832,7 @@ tests = [ assertEqual "show a balanced transaction, eliding last amount" (unlines ["2007/01/28 coopportunity" - ," expenses:food:groceries $47.18" + ," expenses:food:groceries $47.18" ," assets:checking" ,"" ]) @@ -841,12 +841,24 @@ tests = [ [Posting False "expenses:food:groceries" (Mixed [dollars 47.18]) "" RegularPosting ,Posting False "assets:checking" (Mixed [dollars (-47.18)]) "" RegularPosting ] "")) + assertEqual "show a balanced transaction, no eliding" + (unlines + ["2007/01/28 coopportunity" + ," expenses:food:groceries $47.18" + ," assets:checking $-47.18" + ,"" + ]) + (showLedgerTransactionUnelided + (LedgerTransaction (parsedate "2007/01/28") Nothing False "" "coopportunity" "" + [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" - ," expenses:food:groceries $47.18" - ," assets:checking $-47.19" + ," expenses:food:groceries $47.18" + ," assets:checking $-47.19" ,"" ]) (showLedgerTransaction @@ -857,7 +869,7 @@ tests = [ assertEqual "show an unbalanced transaction with one posting, should not elide" (unlines ["2007/01/28 coopportunity" - ," expenses:food:groceries $47.18" + ," expenses:food:groceries $47.18" ,"" ]) (showLedgerTransaction @@ -867,7 +879,7 @@ tests = [ assertEqual "show a transaction with one posting and a missing amount" (unlines ["2007/01/28 coopportunity" - ," expenses:food:groceries " + ," expenses:food:groceries " ,"" ]) (showLedgerTransaction diff --git a/tests/amountless-virtual-postings.test b/tests/amountless-virtual-postings.test index dceba1196..7b531c868 100644 --- a/tests/amountless-virtual-postings.test +++ b/tests/amountless-virtual-postings.test @@ -7,8 +7,8 @@ (d) >>> 2009/01/01 x - a 1 - b -1 - (c) - (d) + a 1 + b -1 + (c) + (d) diff --git a/tests/comment-line-after-postings.test b/tests/comment-line-after-postings.test index 3700ab469..974260cd1 100644 --- a/tests/comment-line-after-postings.test +++ b/tests/comment-line-after-postings.test @@ -6,6 +6,6 @@ ; comment line after postings >>> 2009/01/01 x - a 1 - b + a 1 + b -1 diff --git a/tests/commented-posting.test b/tests/commented-posting.test index 19072e98e..8b834fe98 100644 --- a/tests/commented-posting.test +++ b/tests/commented-posting.test @@ -6,6 +6,6 @@ b >>> 2009/01/01 x - a 1 - b + a 1 + b -1 diff --git a/tests/effective-print.test b/tests/effective-print.test index 891d9b35b..c188bdbf3 100644 --- a/tests/effective-print.test +++ b/tests/effective-print.test @@ -5,6 +5,6 @@ b >>> 2010/01/01 x - a 1 - b + a 1 + b -1 diff --git a/tests/parens-in-account-name.test b/tests/parens-in-account-name.test index 6fbff5e7c..5f71abf2b 100644 --- a/tests/parens-in-account-name.test +++ b/tests/parens-in-account-name.test @@ -6,7 +6,7 @@ c >>> 2009/01/01 x - a 2 - b (b) b -1 - c + a 2 + b (b) b -1 + c -1 diff --git a/tests/print-preserves-comments.test b/tests/print-preserves-comments.test index 3b3359c92..b46570098 100644 --- a/tests/print-preserves-comments.test +++ b/tests/print-preserves-comments.test @@ -11,7 +11,7 @@ 2009/01/01 x ; description comment a 1 ; amount comment ; middle posting comment - b + b -1 ; trailing posting comment ; post-entry comment (?) diff --git a/tests/unicode-error-message.test.notimplemented b/tests/unicode-error-message.test.notimplemented index 76edf820c..1dc4ab76e 100644 --- a/tests/unicode-error-message.test.notimplemented +++ b/tests/unicode-error-message.test.notimplemented @@ -8,6 +8,6 @@ unexpected end of input could not balance this transaction, amounts do not add up to zero: 2009/01/01 broken entry - дебит 1 - кредит -2 + дебит 1 + кредит -2 diff --git a/tests/unicode-print.test b/tests/unicode-print.test index c15090377..ca1c7d816 100644 --- a/tests/unicode-print.test +++ b/tests/unicode-print.test @@ -5,6 +5,6 @@ счёт:второй >>> 2009/01/01 проверка - счёт:первый 1 - счёт:второй + счёт:первый 1 + счёт:второй -1 diff --git a/tests/virtual.test b/tests/virtual.test index af218fcd7..206772bbe 100644 --- a/tests/virtual.test +++ b/tests/virtual.test @@ -6,7 +6,7 @@ b >>> 2009/01/01 x - (virtual) 100 - a 1 - b + (virtual) 100 + a 1 + b -1