From 5ea088d1ca85099ad5bf914c0c1f7e8b3e0f3d60 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 13 Aug 2016 07:47:43 -0700 Subject: [PATCH] bs,is,cf: add functional tests, fix bs infinite loop #393 --- hledger/Hledger/Cli/Balancesheet.hs | 3 +-- tests/balancesheet/balancesheet.test | 23 ++++++++++++++++++++++ tests/cashflow/cashflow.test | 19 ++++++++++++++++++ tests/incomestatement/incomestatement.test | 23 ++++++++++++++++++++++ 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tests/balancesheet/balancesheet.test create mode 100644 tests/cashflow/cashflow.test create mode 100644 tests/incomestatement/incomestatement.test diff --git a/hledger/Hledger/Cli/Balancesheet.hs b/hledger/Hledger/Cli/Balancesheet.hs index eb774e136..5709d4b32 100644 --- a/hledger/Hledger/Cli/Balancesheet.hs +++ b/hledger/Hledger/Cli/Balancesheet.hs @@ -58,8 +58,7 @@ Total: withoutBeginDate :: ReportOpts -> ReportOpts withoutBeginDate ropts@ReportOpts{..} = ropts{period_=p} where - p = dateSpanAsPeriod $ DateSpan Nothing e - e = periodEnd p + p = dateSpanAsPeriod $ DateSpan Nothing (periodEnd period_) tests_Hledger_Cli_Balancesheet :: Test tests_Hledger_Cli_Balancesheet = TestList diff --git a/tests/balancesheet/balancesheet.test b/tests/balancesheet/balancesheet.test new file mode 100644 index 000000000..2ee0b009a --- /dev/null +++ b/tests/balancesheet/balancesheet.test @@ -0,0 +1,23 @@ +# 1. +hledger -f - balancesheet +<<< +2016/1/1 + assets 1 + b +>>> +Balance Sheet + +Assets: + 1 assets +-------------------- + 1 + +Liabilities: +-------------------- + 0 + +Total: +-------------------- + 1 +>>>2 +>>>= 0 diff --git a/tests/cashflow/cashflow.test b/tests/cashflow/cashflow.test new file mode 100644 index 000000000..e8ef2e817 --- /dev/null +++ b/tests/cashflow/cashflow.test @@ -0,0 +1,19 @@ +# 1. +hledger -f - cashflow +<<< +2016/1/1 + assets 1 + b +>>> +Cashflow Statement + +Cash flows: + 1 assets +-------------------- + 1 + +Total: +-------------------- + 1 +>>>2 +>>>= 0 diff --git a/tests/incomestatement/incomestatement.test b/tests/incomestatement/incomestatement.test new file mode 100644 index 000000000..39c63d6b7 --- /dev/null +++ b/tests/incomestatement/incomestatement.test @@ -0,0 +1,23 @@ +# 1. +hledger -f - incomestatement +<<< +2016/1/1 + income 1 + b +>>> +Income Statement + +Revenues: + 1 income +-------------------- + 1 + +Expenses: +-------------------- + 0 + +Total: +-------------------- + 1 +>>>2 +>>>= 0