summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/filters.cc3
-rw-r--r--src/report.cc2
-rw-r--r--test/baseline/opt-daily.test56
-rw-r--r--test/baseline/opt-date-format.test11
-rw-r--r--test/baseline/opt-date-width.test11
-rw-r--r--test/baseline/opt-display-amount.test65
-rw-r--r--test/baseline/opt-display-total.test65
-rw-r--r--test/baseline/opt-display.test59
-rw-r--r--test/baseline/opt-dow.test55
9 files changed, 326 insertions, 1 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 651bc762..0e719037 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -416,6 +416,9 @@ void changed_value_xacts::operator()(xact_t& xact)
void subtotal_xacts::report_subtotal(const char * spec_fmt)
{
+ if (component_xacts.empty())
+ return;
+
date_t start;
date_t finish;
foreach (xact_t * xact, component_xacts) {
diff --git a/src/report.cc b/src/report.cc
index e4fde182..1227e317 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -356,7 +356,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
else OPT_(display_);
else OPT(display_amount_);
else OPT(display_total_);
- else OPT(dow);
+ else OPT_ALT(dow, days-of-week);
else OPT(date_width_);
break;
case 'e':
diff --git a/test/baseline/opt-daily.test b/test/baseline/opt-daily.test
new file mode 100644
index 00000000..0ff3987f
--- /dev/null
+++ b/test/baseline/opt-daily.test
@@ -0,0 +1,56 @@
+reg --daily
+<<<
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+>>>1
+08-Jan-01 - 08-Jan-01 Assets:Cash $-60.00 $-60.00
+ Expenses:Books $60.00 0
+08-Feb-01 - 08-Feb-01 Assets:Cash $-120.00 $-120.00
+ Expenses:Books $120.00 0
+>>>2
+=== 0
diff --git a/test/baseline/opt-date-format.test b/test/baseline/opt-date-format.test
new file mode 100644
index 00000000..7a6983cf
--- /dev/null
+++ b/test/baseline/opt-date-format.test
@@ -0,0 +1,11 @@
+reg --date-format='%Y'
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+2007 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Di:Vanguard:VMMXX $-0.35 $-0.35
+ 0.350 VMMXX
+>>>2
+=== 0
diff --git a/test/baseline/opt-date-width.test b/test/baseline/opt-date-width.test
new file mode 100644
index 00000000..47652099
--- /dev/null
+++ b/test/baseline/opt-date-width.test
@@ -0,0 +1,11 @@
+reg --date-width=20
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Di:Vanguard:VMMXX $-0.35 $-0.35
+ 0.350 VMMXX
+>>>2
+=== 0
diff --git a/test/baseline/opt-display-amount.test b/test/baseline/opt-display-amount.test
new file mode 100644
index 00000000..45eac079
--- /dev/null
+++ b/test/baseline/opt-display-amount.test
@@ -0,0 +1,65 @@
+reg --display-amount='amount * 10' books
+<<<
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+>>>1
+08-Jan-01 January Expenses:Books $100.00 $10.00
+08-Jan-01 End of January Expenses:Books $100.00 $20.00
+08-Jan-01 January Expenses:Books $100.00 $30.00
+08-Jan-01 End of January Expenses:Books $100.00 $40.00
+08-Jan-01 January Expenses:Books $100.00 $50.00
+08-Jan-01 End of January Expenses:Books $100.00 $60.00
+08-Feb-01 February Expenses:Books $200.00 $80.00
+08-Feb-01 End of February Expenses:Books $200.00 $100.00
+08-Feb-01 February Expenses:Books $200.00 $120.00
+08-Feb-01 End of February Expenses:Books $200.00 $140.00
+08-Feb-01 February Expenses:Books $200.00 $160.00
+08-Feb-01 End of February Expenses:Books $200.00 $180.00
+>>>2
+=== 0
diff --git a/test/baseline/opt-display-total.test b/test/baseline/opt-display-total.test
new file mode 100644
index 00000000..9a6e67d6
--- /dev/null
+++ b/test/baseline/opt-display-total.test
@@ -0,0 +1,65 @@
+reg --display-total='amount * 10' books
+<<<
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+>>>1
+08-Jan-01 January Expenses:Books $10.00 $100.00
+08-Jan-01 End of January Expenses:Books $10.00 $100.00
+08-Jan-01 January Expenses:Books $10.00 $100.00
+08-Jan-01 End of January Expenses:Books $10.00 $100.00
+08-Jan-01 January Expenses:Books $10.00 $100.00
+08-Jan-01 End of January Expenses:Books $10.00 $100.00
+08-Feb-01 February Expenses:Books $20.00 $200.00
+08-Feb-01 End of February Expenses:Books $20.00 $200.00
+08-Feb-01 February Expenses:Books $20.00 $200.00
+08-Feb-01 End of February Expenses:Books $20.00 $200.00
+08-Feb-01 February Expenses:Books $20.00 $200.00
+08-Feb-01 End of February Expenses:Books $20.00 $200.00
+>>>2
+=== 0
diff --git a/test/baseline/opt-display.test b/test/baseline/opt-display.test
new file mode 100644
index 00000000..4f01a706
--- /dev/null
+++ b/test/baseline/opt-display.test
@@ -0,0 +1,59 @@
+reg --display='payee =~ /February/' books
+<<<
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+>>>1
+08-Feb-01 February Expenses:Books $20.00 $80.00
+08-Feb-01 End of February Expenses:Books $20.00 $100.00
+08-Feb-01 February Expenses:Books $20.00 $120.00
+08-Feb-01 End of February Expenses:Books $20.00 $140.00
+08-Feb-01 February Expenses:Books $20.00 $160.00
+08-Feb-01 End of February Expenses:Books $20.00 $180.00
+>>>2
+=== 0
diff --git a/test/baseline/opt-dow.test b/test/baseline/opt-dow.test
new file mode 100644
index 00000000..bbd5aa0c
--- /dev/null
+++ b/test/baseline/opt-dow.test
@@ -0,0 +1,55 @@
+reg --dow books
+<<<
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/01 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/01 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+>>>1
+08-Jan-01 Tuesdays Expenses:Books $60.00 $60.00
+08-Feb-01 Fridays Expenses:Books $120.00 $180.00
+>>>2
+=== 0