From e491f513a12c00194f59cc5805a57ef77ee64e78 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 23 Jan 2018 12:47:56 -0800 Subject: [PATCH] cli: tabular reports no longer have a trailing blank line added Tabular reports from bal, bs etc. have until now been rendered on the terminal with one final blank line, for readability. This change drops the blank line. This is consistent with the non-tabular balance and register output (not print, which is a special case), and with most unix commands. The real reason for it, which I admit is flimsy, is that I can now omit the final delimiter (>=0) when using shelltestrunner 1.9's new format, making functional tests easier to maintain and more readable. If there's opposition, this could be reverted. --- hledger/Hledger/Cli/Commands/Balance.hs | 2 -- tests/balance/219.test | 2 -- tests/balance/depth.test | 1 - tests/balance/intervals.test | 17 ----------------- tests/balance/pretty.test | 1 - tests/balancesheet/balancesheet.test | 8 -------- tests/bin/budget.test | 5 ----- tests/budget/budget.test | 3 --- tests/budget/forecast.test | 1 - tests/cashflow/cashflow.test | 10 ---------- tests/cli/multiple-files.test | 1 - tests/i18n/wide-char-layout.test | 1 - tests/incomestatement/incomestatement.test | 7 ------- 13 files changed, 59 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Balance.hs b/hledger/Hledger/Cli/Commands/Balance.hs index 3723c3446..a055e7a2d 100644 --- a/hledger/Hledger/Cli/Commands/Balance.hs +++ b/hledger/Hledger/Cli/Commands/Balance.hs @@ -703,13 +703,11 @@ renderBalanceReportTable ropts = renderBalanceReportTable' :: ReportOpts -> (a -> String) -> Table String String a -> String renderBalanceReportTable' (ReportOpts { pretty_tables_ = pretty}) showCell = unlines - . addtrailingblank . trimborder . lines . render pretty id id showCell . align where - addtrailingblank = (++[""]) trimborder = drop 1 . init . map (drop 1 . init) align (Table l t d) = Table l' t d where diff --git a/tests/balance/219.test b/tests/balance/219.test index 5a5a75a0e..6892a606e 100644 --- a/tests/balance/219.test +++ b/tests/balance/219.test @@ -7,7 +7,6 @@ Ending balances (historical) in 2013/01: || 2013/01/31 =================++============ assets:checking || 10 - >>>= 0 # 2. multiple flags ending with --tree, equivalent to --tree @@ -19,5 +18,4 @@ Ending balances (historical) in 2013/01: ============++============ assets || 10 checking || 10 - >>>= 0 diff --git a/tests/balance/depth.test b/tests/balance/depth.test index db4047269..b75d1fa14 100644 --- a/tests/balance/depth.test +++ b/tests/balance/depth.test @@ -23,6 +23,5 @@ Balance changes in 2008/01: ... || 0 -----++--------- || 0 - >>>=0 diff --git a/tests/balance/intervals.test b/tests/balance/intervals.test index 656c8ecf3..7d4d1148e 100644 --- a/tests/balance/intervals.test +++ b/tests/balance/intervals.test @@ -21,7 +21,6 @@ Balance changes in 2013q1: assets || 0 1 0 assets:cash || 0 1 0 assets:checking || 0 0 1 - >>>=0 # 3. With --empty, includes leading/trailing empty periods @@ -42,7 +41,6 @@ Balance changes in 2013: a || 2 0 0 0 ---++-------------------------------- || 2 0 0 0 - >>>=0 # 4. A cumulative ending balance report. Column totals are the sum of @@ -58,7 +56,6 @@ Ending balances (cumulative) in 2013q1: assets:checking || 0 0 1 -----------------++------------------------------------ || 0 2 3 - >>>=0 # 5. With the assets:cash account excluded. As with a single-column @@ -74,7 +71,6 @@ Ending balances (cumulative) in 2013q1: assets:checking || 0 0 1 -----------------++------------------------------------ || 0 1 2 - >>>=0 # 6. A historical ending balance report. @@ -89,7 +85,6 @@ Ending balances (historical) in 2013q1: assets:checking || 10 10 11 -----------------++------------------------------------ || 10 12 13 - >>>=0 # 7. With top-level accounts excluded. As always, column totals are the sum of @@ -104,7 +99,6 @@ Balance changes in 2013q1: assets:checking || 0 0 1 -----------------++--------------------------- || 0 1 1 - >>>=0 # 8. cumulative: @@ -118,7 +112,6 @@ Ending balances (cumulative) in 2013q1: assets:checking || 0 0 1 -----------------++------------------------------------ || 0 1 2 - >>>=0 # 9. historical @@ -133,7 +126,6 @@ Ending balances (historical) in 2013q1: assets:checking || 10 10 11 -----------------++------------------------------------ || 10 12 13 - >>>=0 # --depth @@ -148,7 +140,6 @@ Balance changes in 2013q1: assets || 0 2 1 --------++--------------------------- || 0 2 1 - >>>=0 # 11. As above, but postings in the top-level assets account have been excluded. @@ -161,7 +152,6 @@ Balance changes in 2013q1: assets || 0 1 1 --------++--------------------------- || 0 1 1 - >>>=0 # 12. A cumulative balance report with depth limiting. @@ -174,7 +164,6 @@ Ending balances (cumulative) in 2013q1: assets || 0 2 3 --------++------------------------------------ || 0 2 3 - >>>=0 # 13. A historical balance report with depth limiting. @@ -187,7 +176,6 @@ Ending balances (historical) in 2013q1: assets || 10 12 13 --------++------------------------------------ || 10 12 13 - >>>=0 # 14. The three multicol balance report types again, this time with --tree @@ -202,7 +190,6 @@ Balance changes in 2013q1: checking || 0 0 1 ------------++--------------------------- || 0 2 1 - >>>=0 # 15. @@ -217,7 +204,6 @@ Ending balances (cumulative) in 2013q1: checking || 0 0 1 ------------++------------------------------------ || 0 2 3 - >>>=0 # 16. @@ -232,7 +218,6 @@ Ending balances (historical) in 2013q1: checking || 10 10 11 ------------++------------------------------------ || 10 12 13 - >>>=0 # 17. --date2 should work @@ -253,7 +238,6 @@ Balance changes in 2014/01: b || 1 ---++--------- || 2 - >>>=0 # 18. All matched postings in the displayed intervals should be reported on. @@ -278,5 +262,4 @@ Balance changes in 2014/01/01-2014/02/28: within || 0 1 --------++------------------ || 1 2 - >>>=0 diff --git a/tests/balance/pretty.test b/tests/balance/pretty.test index fa66da6ad..5991bd500 100644 --- a/tests/balance/pretty.test +++ b/tests/balance/pretty.test @@ -9,5 +9,4 @@ Balance changes in 2012/12/01-2013/03/31: assets:checking ║ 10 0 0 1 ─────────────────╫──────────────────────────────────── ║ 10 0 2 1 - >>>=0 diff --git a/tests/balancesheet/balancesheet.test b/tests/balancesheet/balancesheet.test index 415df5dc5..fbc3956ec 100644 --- a/tests/balancesheet/balancesheet.test +++ b/tests/balancesheet/balancesheet.test @@ -21,7 +21,6 @@ Balance Sheet 2016/01/01 || =============++============ Net: || 1 - >>>2 >>>= 0 @@ -68,7 +67,6 @@ Balance Sheet 2008 || 0 0 0 0 0 0 0 0 0 0 0 $-1 ======================++================================================================================================================================================ Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 - >>>=0 # 3. monthly balance sheet in tree mode @@ -118,7 +116,6 @@ Balance Sheet 2008 || 0 0 0 0 0 0 0 0 0 0 0 $-1 ==============++================================================================================================================================================ Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 - >>>= 0 # 4. monthly balancesheet with average/total columns and without overall totals row @@ -141,7 +138,6 @@ Balance Sheet 2008 liabilities:debts || 0 0 0 0 0 0 0 0 0 0 0 $-1 $-1 0 ----------------------++------------------------------------------------------------------------------------------------------------------------------------------------------------------ || 0 0 0 0 0 0 0 0 0 0 0 $-1 $-1 0 - >>>= 0 # 5. Tree output still works, #565 @@ -167,7 +163,6 @@ Balance Sheet 2017/01/01 || =============++============ Net: || 1 - >>>2 >>>=0 @@ -193,7 +188,6 @@ Balance Sheet 2017/01/01 || =============++============ Net: || 1 - >>>2 >>>=0 @@ -219,7 +213,6 @@ Balance Sheet 2017/01/01 || =============++============================== Net: || $1 $1 $1 - >>>2 >>>=0 @@ -246,6 +239,5 @@ Balance Sheet 2016/01/01 ║ ═════════════╬════════════ Net: ║ 1 - >>>2 >>>= 0 diff --git a/tests/bin/budget.test b/tests/bin/budget.test index 76db96586..7e2a4932b 100644 --- a/tests/bin/budget.test +++ b/tests/bin/budget.test @@ -41,7 +41,6 @@ Ending balances (historical) in 2016/12/31-2017/01/02: budget:food || 0 $-50.00 $-50.00 budget:housing || $-600.00 $-600.00 $-600.00 budget:misc || 0 $-15.00 $-16.60 - >>>2 >>>=0 @@ -160,7 +159,6 @@ Ending balances (historical) in 2016/12/26-2017/01/04: expenses:grocery || $-50 $-50 $-50 $-50 $-50 $-50 $-20.00 $-70.00 $-70.00 $-70.00 expenses:housing || $-250 $-250 $-250 $-250 $-250 $350.00 $350.00 $100.00 $100.00 $100.00 expenses:leisure || $-20 $-20 $-20 $-20 $-20 $-20 $-5.00 $-25.00 $-25.00 $-25.00 - >>>2 >>>=0 @@ -194,7 +192,6 @@ Ending balances (historical) in 2016/12/31-2017/01/01: expenses:grocery || 0 $30 expenses:housing:rent || $600 $600 expenses:leisure || 0 $15 - >>>2 >>>=0 @@ -226,7 +223,6 @@ Ending balances (historical) in 2016/12/31-2017/01/01: ===============++======================== || $600 $646 expenses:food || 0 $20 - >>>2 >>>=0 @@ -260,6 +256,5 @@ Ending balances (historical) in 2016/12/31-2017/01/01: expenses:grocery || 0 $30 expenses:housing:rent || $600 $600 expenses:leisure || 0 $15 - >>>2 >>>=0 diff --git a/tests/budget/budget.test b/tests/budget/budget.test index 5a5a23080..87c2a4c2e 100644 --- a/tests/budget/budget.test +++ b/tests/budget/budget.test @@ -40,7 +40,6 @@ Balance changes in 2016/12/01-2016/12/03: expenses:leisure || 0 [0% of $15] $5 [33% of $15] 0 [0% of $15] -----------------------++------------------------------------------------------------- || 0 0 0 - >>>2 >>>=0 @@ -87,7 +86,6 @@ Balance changes in 2016/12/01-2016/12/03: expenses:movies || 0 0 $25 ------------------++------------------------------------------------------------- || 0 0 0 - >>>2 >>>=0 @@ -137,6 +135,5 @@ Balance changes in 2016/12/01-2016/12/03: expenses:leisure || 0 [0% of $15] $5 [33% of $15] 0 [0% of $15] -----------------------++---------------------------------------------------------------- || $-15, £10 $-21.0, 20 CAD 0 - >>>2 >>>=0 diff --git a/tests/budget/forecast.test b/tests/budget/forecast.test index 0e9a1904f..a1a87fdfc 100644 --- a/tests/budget/forecast.test +++ b/tests/budget/forecast.test @@ -24,7 +24,6 @@ Balance changes in 2016/12/01-2017/01/31: income || 0 $-1000 ------------------++------------------ || 0 0 - >>>2 >>>=0 diff --git a/tests/cashflow/cashflow.test b/tests/cashflow/cashflow.test index 692b376f6..7031b5358 100644 --- a/tests/cashflow/cashflow.test +++ b/tests/cashflow/cashflow.test @@ -14,7 +14,6 @@ Cashflow Statement 2016/01/01 assets || 1 ------------++------------ || 1 - >>>2 >>>= 0 @@ -50,7 +49,6 @@ Cashflow Statement 2016 assets:checking || $-40.00 -----------------++--------- || $-40.00 - >>>2 >>>= 0 @@ -86,7 +84,6 @@ Cashflow Statement 2015/01/01-2016/12/31 assets:checking || $9,960.00 -----------------++----------------------- || $9,960.00 - >>>2 >>>= 0 @@ -122,7 +119,6 @@ Cashflow Statement 2015/11 assets:checking || $10,000.00 -----------------++------------ || $10,000.00 - >>>2 >>>= 0 @@ -157,7 +153,6 @@ Cashflow Statement 2016/10 ------------++--------- ------------++--------- || 0 - >>>2 >>>= 0 @@ -175,7 +170,6 @@ Cashflow Statement 2008 assets:cash || 0 0 0 0 0 $-2 0 0 0 0 0 0 ----------------------++------------------------------------------------------------------------------------------------------------ || $1 0 0 0 0 $-1 0 0 0 0 0 $-1 - >>>= 0 # 7. Multicolumn test (historical) @@ -192,7 +186,6 @@ Cashflow Statement 2008 (Historical Ending Balances) assets:cash || 0 0 0 0 0 $-2 $-2 $-2 $-2 $-2 $-2 $-2 $-1 ----------------------++--------------------------------------------------------------------------------------------------------------------------------------------------------- || $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1 0 - >>>= 0 # 8. without -N/--no-total @@ -208,7 +201,6 @@ Cashflow Statement 2008 assets:cash || $-2 --------------------++------ || $-1 - >>>2 >>>= 0 @@ -223,7 +215,6 @@ Cashflow Statement 2008 --------------------++------ assets:bank:saving || $1 assets:cash || $-2 - >>>2 >>>= 0 @@ -247,6 +238,5 @@ Cashflow Statement 2016/01/01 assets || 1 ------------++------------ || 1 - >>>2 >>>= 0 diff --git a/tests/cli/multiple-files.test b/tests/cli/multiple-files.test index 83a7db3cb..1963737dc 100644 --- a/tests/cli/multiple-files.test +++ b/tests/cli/multiple-files.test @@ -18,7 +18,6 @@ Income Statement 2014/01/01-2014/01/02 || $2 ==========================++======================= Net: || $-2 - >>>2 >>>=0 diff --git a/tests/i18n/wide-char-layout.test b/tests/i18n/wide-char-layout.test index 90fe0ef82..8c643cf0c 100644 --- a/tests/i18n/wide-char-layout.test +++ b/tests/i18n/wide-char-layout.test @@ -71,7 +71,6 @@ Balance changes in 2014: 㐀:㐁:㐂:㐃:㐄 || 1 ----------------++------ || 0 - >>>2 >>>=0 diff --git a/tests/incomestatement/incomestatement.test b/tests/incomestatement/incomestatement.test index 5e18f19ba..8f7a17551 100644 --- a/tests/incomestatement/incomestatement.test +++ b/tests/incomestatement/incomestatement.test @@ -21,7 +21,6 @@ Income Statement 2016/01/01 || ==========++============ Net: || -1 - >>>2 >>>= 0 @@ -65,7 +64,6 @@ Income Statement 2016 || $50.00 ===================++========= Net: || $-40.00 - >>>2 >>>= 0 @@ -110,7 +108,6 @@ Income Statement 2015/01/01-2016/12/31 || $50.00 ===================++======================= Net: || $9,960.00 - >>>2 >>>= 0 @@ -153,7 +150,6 @@ Income Statement 2015/10 || ===================++============ Net: || $10,000.00 - >>>2 >>>= 0 @@ -195,7 +191,6 @@ Income Statement 2016/10 || 0 ==========++========= Net: || 0 - >>>2 >>>= 0 @@ -242,7 +237,6 @@ Income Statement 2008 || 0 0 0 0 0 $2 0 0 0 0 0 0 $2 0 ===================++============================================================================================================================== Net: || $1 0 0 0 0 $-1 0 0 0 0 0 0 0 0 - >>>= 0 # 7. Multicolumn test (historical) @@ -288,5 +282,4 @@ Income Statement 2008 (Historical Ending Balances) || 0 0 0 0 0 $2 $2 $2 $2 $2 $2 $2 ===================++================================================================================================================================================ Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 - >>>= 0