mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 20:02:27 +03:00
[TEST] Add balance/cashflow/incomestatement shelltest
These pass the current version of hledger available on homebrew and cover the bug reported in #514 and fixed in #515.
This commit is contained in:
parent
34a2c8e7e6
commit
4f00925ad5
@ -26,3 +26,125 @@ hledger -f sample.journal balance o
|
||||
$-1
|
||||
>>>=0
|
||||
|
||||
# 3. Period reporting works for a specific year
|
||||
hledger -f - balance -b 2016 -e 2017
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
$-40.00 assets:checking
|
||||
$50.00 expense:hosting
|
||||
$-10.00 revenue:clients:B
|
||||
--------------------
|
||||
0
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 4. Period reporting works for two years
|
||||
hledger -f - balance -b 2015 -e 2017
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
$9,960.00 assets:checking
|
||||
$50.00 expense:hosting
|
||||
$-10,010.00 revenue:clients
|
||||
$-10,000.00 A
|
||||
$-10.00 B
|
||||
--------------------
|
||||
0
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 5. Period reporting works for one month
|
||||
hledger -f - balance -b 2015/11 -e 2015/12
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
0 assets
|
||||
$10,000.00 checking
|
||||
$-10,000.00 receivables
|
||||
--------------------
|
||||
0
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 6. Period reporting works for one month in another year
|
||||
hledger -f - balance -b 2016/10 -e 2016/11
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
--------------------
|
||||
0
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
@ -17,3 +17,146 @@ Total:
|
||||
1
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 2. Period reporting works for a specific year
|
||||
hledger -f - cashflow -b 2016 -e 2017
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Cashflow Statement
|
||||
|
||||
Cash flows:
|
||||
$-40.00 assets:checking
|
||||
--------------------
|
||||
$-40.00
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
$-40.00
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 3. Period reporting works for two years
|
||||
hledger -f - cashflow -b 2015 -e 2017
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Cashflow Statement
|
||||
|
||||
Cash flows:
|
||||
$9,960.00 assets:checking
|
||||
--------------------
|
||||
$9,960.00
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
$9,960.00
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 4. Period reporting works for one month
|
||||
hledger -f - cashflow -b 2015/11 -e 2015/12
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Cashflow Statement
|
||||
|
||||
Cash flows:
|
||||
$10,000.00 assets:checking
|
||||
--------------------
|
||||
$10,000.00
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
$10,000.00
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 5. Period reporting works for one month in another year
|
||||
hledger -f - cashflow -b 2016/10 -e 2016/11
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Cashflow Statement
|
||||
|
||||
Cash flows:
|
||||
--------------------
|
||||
0
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
0
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 1.
|
||||
# 1. Simple statement works
|
||||
hledger -f - incomestatement
|
||||
<<<
|
||||
2016/1/1
|
||||
@ -21,3 +21,166 @@ Total:
|
||||
1
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 2. Period reporting works for a specific year
|
||||
hledger -f - incomestatement -b 2016 -e 2017
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Income Statement
|
||||
|
||||
Revenues:
|
||||
$-10.00 revenue:clients:B
|
||||
--------------------
|
||||
$-10.00
|
||||
|
||||
Expenses:
|
||||
$50.00 expense:hosting
|
||||
--------------------
|
||||
$50.00
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
$40.00
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 3. Period reporting works for two years
|
||||
hledger -f - incomestatement -b 2015 -e 2017
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Income Statement
|
||||
|
||||
Revenues:
|
||||
$-10,010.00 revenue:clients
|
||||
$-10,000.00 A
|
||||
$-10.00 B
|
||||
--------------------
|
||||
$-10,010.00
|
||||
|
||||
Expenses:
|
||||
$50.00 expense:hosting
|
||||
--------------------
|
||||
$50.00
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
$-9,960.00
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 4. Period reporting works for one month
|
||||
hledger -f - incomestatement -b 2015/10 -e 2015/11
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Income Statement
|
||||
|
||||
Revenues:
|
||||
$-10,000.00 revenue:clients:A
|
||||
--------------------
|
||||
$-10,000.00
|
||||
|
||||
Expenses:
|
||||
--------------------
|
||||
0
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
$-10,000.00
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
||||
# 5. Period reporting works for one month in another year
|
||||
hledger -f - incomestatement -b 2016/10 -e 2016/11
|
||||
<<<
|
||||
2015/10/10 Client A | Invoice #1
|
||||
assets:receivables $10,000.00
|
||||
revenue:clients:A -$10,000.00
|
||||
|
||||
2015/11/02 Deposit | Invoice #1
|
||||
assets:checking $10,000.00
|
||||
assets:receivables -$10,000.00
|
||||
|
||||
2016/02/01 Client B | Invoice #2
|
||||
assets:receivables $10.00
|
||||
revenue:clients:B -$10.00
|
||||
|
||||
2016/02/15 ACME | Hosting Costs
|
||||
expense:hosting $50.00
|
||||
assets:checking -$50.00
|
||||
|
||||
2016/03/01 Deposit | Invoice #2
|
||||
assets:checking $10.00
|
||||
assets:receivables -$10.00
|
||||
>>>
|
||||
Income Statement
|
||||
|
||||
Revenues:
|
||||
--------------------
|
||||
0
|
||||
|
||||
Expenses:
|
||||
--------------------
|
||||
0
|
||||
|
||||
Total:
|
||||
--------------------
|
||||
0
|
||||
>>>2
|
||||
>>>= 0
|
||||
|
Loading…
Reference in New Issue
Block a user