reorganise functional tests by command/topic
This commit is contained in:
		
							parent
							
								
									dd736a871c
								
							
						
					
					
						commit
						d1a3516c70
					
				
							
								
								
									
										28
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								Makefile
									
									
									
									
									
								
							| @ -396,11 +396,23 @@ unittest-interpreted: | ||||
| 
 | ||||
| # run functional tests, requires shelltestrunner >= 0.9 from hackage
 | ||||
| # 16 threads sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless
 | ||||
| functest: bin/hledgerdev | ||||
| functest: bin/hledgerdev tests/addons/hledger-addon | ||||
| 	@echo functional tests: | ||||
| 	@($(SHELLTEST) tests -- --threads=16 --hide-successes \
 | ||||
| 	@($(SHELLTEST) --execdir tests -- --threads=16 --hide-successes \
 | ||||
| 		&& echo $@ PASSED) || echo $@ FAILED | ||||
| 
 | ||||
| # generate dummy add-ons for testing (hledger-addon the rest)
 | ||||
| ADDONEXTS=pl py rb sh hs lhs rkt exe com bat | ||||
| tests/addons/hledger-addon: | ||||
| 	rm -rf tests/addons/hledger-* | ||||
| 	printf '#!/bin/sh\necho add-on: $$0\necho args: $$*\n' >tests/ADDONS/hledger-addon | ||||
| 	for E in '' $(ADDONEXTS); do \
 | ||||
| 		cp tests/ADDONS/hledger-addon tests/ADDONS/hledger-addon.$$E; done | ||||
| 	for F in addon. addon2 addon2.hs addon3.exe addon3.lhs addon4.exe add reg; do \
 | ||||
| 		cp tests/ADDONS/hledger-addon tests/ADDONS/hledger-$$F; done | ||||
| 	mkdir tests/ADDONS/hledger-addondir | ||||
| 	chmod +x tests/ADDONS/hledger-* | ||||
| 
 | ||||
| # run unit and functional tests with a specific GHC version
 | ||||
| # some functional tests (add, include, read-csv..) have bin/hledgerdev hard coded - might need to symlink it
 | ||||
| test-ghc-%: # bin/hledgerdev.ghc-$*
 | ||||
| @ -558,18 +570,6 @@ data/10000x10000x10.journal: tools/generatejournal | ||||
| data/100000x1000x10.journal: tools/generatejournal | ||||
| 	tools/generatejournal 100000 1000 10 >$@ | ||||
| 
 | ||||
| ADDONS=tests/addons | ||||
| ADDONEXTS=pl py rb sh hs lhs rkt exe com bat | ||||
| addons: | ||||
| 	rm -rf $(ADDONS)/hledger-* | ||||
| 	printf '#!/bin/sh\necho add-on: $$0\necho args: $$*\n' >$(ADDONS)/hledger-addon | ||||
| 	for E in '' $(ADDONEXTS); do \
 | ||||
| 		cp $(ADDONS)/hledger-addon $(ADDONS)/hledger-addon.$$E; done | ||||
| 	for F in addon. addon2 addon2.hs addon3.exe addon3.lhs addon4.exe add reg; do \
 | ||||
| 		cp $(ADDONS)/hledger-addon $(ADDONS)/hledger-$$F; done | ||||
| 	mkdir $(ADDONS)/hledger-addondir | ||||
| 	chmod +x $(ADDONS)/hledger-* | ||||
| 
 | ||||
| ######################################################################
 | ||||
| # DOCUMENTATION
 | ||||
| 
 | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| Add-on scripts to test add-on detection (when this directory is added to PATH). | ||||
							
								
								
									
										17
									
								
								tests/addons/addons.test
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								tests/addons/addons.test
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| # "make test" sets up the dummy add-on scripts required for these tests | ||||
| 
 | ||||
| # 14. flags after an add-command are handled by the add-on | ||||
| PATH=$PATH:. hledgerdev addon --help | ||||
| >>> /hledger-addon/ | ||||
| >>>=0 | ||||
| 
 | ||||
| # 15. add-on flags which are not also defined in the main executable are a problem | ||||
| PATH=$PATH:. hledgerdev addon --addonflag | ||||
| >>>2 /Unknown flag: --addonflag/ | ||||
| >>>=1 | ||||
| 
 | ||||
| # 16. hledger main executable ignores anything after -- (and hides the -- from the add-on) | ||||
| PATH=$PATH:. hledgerdev addon --help -- --addonflag | ||||
| >>> /hledger-addon/ | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -1,5 +1,5 @@ | ||||
| # 1. | ||||
| hledgerdev -f data/sample.journal balance | ||||
| hledgerdev -f sample.journal balance | ||||
| >>> | ||||
|                  $-1  assets | ||||
|                   $1    bank:saving | ||||
| @ -16,7 +16,7 @@ hledgerdev -f data/sample.journal balance | ||||
| >>>=0 | ||||
| 
 | ||||
| # 2.  | ||||
| hledgerdev -f data/sample.journal balance o | ||||
| hledgerdev -f sample.journal balance o | ||||
| >>> | ||||
|                   $1  expenses:food | ||||
|                  $-2  income | ||||
| @ -1,5 +1,5 @@ | ||||
| # 1 | ||||
| hledgerdev -f data/sample.journal balance --no-total --depth 1 | ||||
| hledgerdev -f sample.journal balance --no-total --depth 1 | ||||
| >>> | ||||
|                  $-1  assets | ||||
|                   $2  expenses | ||||
| @ -1,4 +1,4 @@ | ||||
| hledgerdev -f data/sample.journal balance --format="%30(account) %-.20(total)" | ||||
| hledgerdev -f sample.journal balance --format="%30(account) %-.20(total)" | ||||
| >>> | ||||
|                         assets $-1 | ||||
|                    bank:saving $1 | ||||
| @ -1,7 +1,7 @@ | ||||
| # multi-column balance reports | ||||
| 
 | ||||
| # 1. Here are the postings used in most tests below: | ||||
| hledgerdev -f data/balance-multicol.journal register | ||||
| hledgerdev -f balance-multicol.journal register | ||||
| >>> | ||||
| 2012/12/31                      (assets:checking)               10            10 | ||||
| 2013/01/01                      (assets:checking)                1            11 | ||||
| @ -12,7 +12,7 @@ hledgerdev -f data/balance-multicol.journal register | ||||
| >>>=0 | ||||
| 
 | ||||
| # 2. A period balance (flow) report. --no-total also works but isn't pretty. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --no-total | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --no-total | ||||
| >>> | ||||
| Change of balance (flow): | ||||
| 
 | ||||
| @ -27,7 +27,7 @@ Change of balance (flow): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 3. With --empty, includes leading/trailing empty periods | ||||
| #hledgerdev -f data/balance-multicol.journal balance -p 'quarterly in 2013' --empty | ||||
| #hledgerdev -f balance-multicol.journal balance -p 'quarterly in 2013' --empty | ||||
| hledgerdev -f - balance -p 'quarterly in 2013' --empty | ||||
| <<< | ||||
| 2012/12/31 | ||||
| @ -49,7 +49,7 @@ Change of balance (flow): | ||||
| 
 | ||||
| # 4. A cumulative ending balance report. Column totals are the sum of | ||||
| # the highest-level displayed accounts (here, assets). | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative | ||||
| >>> | ||||
| Ending balance (cumulative): | ||||
| 
 | ||||
| @ -66,7 +66,7 @@ Ending balance (cumulative): | ||||
| # 5. With the assets:cash account excluded.  As with a single-column | ||||
| # balance --flat report, or ledger's balance --flat, assets' balance | ||||
| # includes the displayed subaccount and not the excluded one. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash | ||||
| >>> | ||||
| Ending balance (cumulative): | ||||
| 
 | ||||
| @ -80,7 +80,7 @@ Ending balance (cumulative): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 6. A historical ending balance report. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --historical | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --historical | ||||
| >>> | ||||
| Ending balance (historical): | ||||
| 
 | ||||
| @ -96,7 +96,7 @@ Ending balance (historical): | ||||
| 
 | ||||
| # 7. With top-level accounts excluded. As always, column totals are the sum of | ||||
| # the highest-level displayed accounts, now assets:cash and assets:checking. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' not:assets$ | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ | ||||
| >>> | ||||
| Change of balance (flow): | ||||
| 
 | ||||
| @ -110,7 +110,7 @@ Change of balance (flow): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 8. cumulative: | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative | ||||
| >>> | ||||
| Ending balance (cumulative): | ||||
| 
 | ||||
| @ -124,7 +124,7 @@ Ending balance (cumulative): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 9. historical | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --historical | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --historical | ||||
| >>> | ||||
| Ending balance (historical): | ||||
| 
 | ||||
| @ -141,7 +141,7 @@ Ending balance (historical): | ||||
| # --depth | ||||
| 
 | ||||
| # 10. A flow report with depth limiting. The depth limit aggregates the three accounts as "assets". | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 | ||||
| >>> | ||||
| Change of balance (flow): | ||||
| 
 | ||||
| @ -154,7 +154,7 @@ Change of balance (flow): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 11. As above, but postings in the top-level assets account have been excluded. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 assets: | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 assets: | ||||
| >>> | ||||
| Change of balance (flow): | ||||
| 
 | ||||
| @ -167,7 +167,7 @@ Change of balance (flow): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 12. A cumulative balance report with depth limiting. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --cumulative | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --cumulative | ||||
| >>> | ||||
| Ending balance (cumulative): | ||||
| 
 | ||||
| @ -180,7 +180,7 @@ Ending balance (cumulative): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 13. A historical balance report with depth limiting. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --historical | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --historical | ||||
| >>> | ||||
| Ending balance (historical): | ||||
| 
 | ||||
| @ -193,7 +193,7 @@ Ending balance (historical): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 14. The three multicol balance report types again, this time with --tree | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --tree | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --tree | ||||
| >>> | ||||
| Change of balance (flow): | ||||
| 
 | ||||
| @ -208,7 +208,7 @@ Change of balance (flow): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 15. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative --tree | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative --tree | ||||
| >>> | ||||
| Ending balance (cumulative): | ||||
| 
 | ||||
| @ -223,7 +223,7 @@ Ending balance (cumulative): | ||||
| >>>=0 | ||||
| 
 | ||||
| # 16. | ||||
| hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --historical --tree | ||||
| hledgerdev -f balance-multicol.journal balance -p 'monthly in 2013' --historical --tree | ||||
| >>> | ||||
| Ending balance (historical): | ||||
| 
 | ||||
							
								
								
									
										1
									
								
								tests/balance/sample.journal
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								tests/balance/sample.journal
									
									
									
									
									
										Symbolic link
									
								
							| @ -0,0 +1 @@ | ||||
| ../../data/sample.journal | ||||
| @ -131,20 +131,3 @@ hledgerdev register -f/dev/null --alias=somealiases --rules-file -? -h --help -- | ||||
| >>> /^register \[OPTIONS\]/ | ||||
| >>>=0 | ||||
| 
 | ||||
| # do "make addons" to set up for these: | ||||
| 
 | ||||
| # 14. flags after an add-command are handled by the add-on | ||||
| PATH=$PATH:tests/addons hledgerdev addon --help | ||||
| >>> /hledger-addon/ | ||||
| >>>=0 | ||||
| 
 | ||||
| # 15. add-on flags which are not also defined in the main executable are a problem | ||||
| PATH=$PATH:tests/addons hledgerdev addon --addonflag | ||||
| >>>2 /Unknown flag: --addonflag/ | ||||
| >>>=1 | ||||
| 
 | ||||
| # 16. hledger main executable ignores anything after -- (and hides the -- from the add-on) | ||||
| PATH=$PATH:tests/addons hledgerdev addon --help -- --addonflag | ||||
| >>> /hledger-addon/ | ||||
| >>>=0 | ||||
| 
 | ||||
| @ -1,10 +0,0 @@ | ||||
| # b amount with no decimal places, in middle, causes balance failure (0.6.1) | ||||
| hledgerdev -f - print | ||||
| <<< | ||||
| 2009/1/1 x | ||||
|     a         $1.25 | ||||
|     b         $-1 | ||||
|     c         $-0.25 | ||||
| 
 | ||||
| >>>2 | ||||
| >>>=0 | ||||
| @ -1,9 +0,0 @@ | ||||
| hledgerdev -f- print | ||||
| <<< | ||||
| 2009/1/1 x | ||||
|  aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa  €1 | ||||
|  b | ||||
| >>> | ||||
| 2009/01/01 x | ||||
|     aa:aaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa | ||||
|     b | ||||
| @ -1,7 +0,0 @@ | ||||
| hledgerdev -f- register | ||||
| <<< | ||||
| 2009/1/1 x aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa  €1 | ||||
|  b | ||||
| >>> | ||||
| 2009/01/01 x                    aa:aa:aaaaaaaaaaaaaaaa           €1           €1 | ||||
|                                 b                               €-1            0 | ||||
| @ -46,7 +46,21 @@ hledgerdev -f - balance | ||||
|                    0 | ||||
| >>>=0 | ||||
| 
 | ||||
| # 4. mixed amounts with prices | ||||
| # 4. a zero amount is always displayed as just "0", regardless of any commodity/decimal places/price (like ledger) | ||||
| # | ||||
| hledgerdev -f- print --empty | ||||
| <<< | ||||
| 2010/3/1 x | ||||
|   a  $0.00 @ 3EUR | ||||
|   b | ||||
| >>> | ||||
| 2010/03/01 x | ||||
|     a             0 | ||||
|     b             0 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| # 5. mixed amounts with prices | ||||
| # XXX | ||||
| # hledgerdev -f - print | ||||
| # <<< | ||||
| @ -1,7 +0,0 @@ | ||||
| # hledgerdev -f - balance -E | ||||
| # <<< | ||||
| # 2009/1/1 x | ||||
| #  a:  13 | ||||
| #  b | ||||
| # >>>2 /accountname seems ill-formed: a:/ | ||||
| # >>>= 1 | ||||
| @ -1,13 +0,0 @@ | ||||
| # should give an accurate parse error location | ||||
| # hledgerdev -f- stat | ||||
| # <<< | ||||
| # 2010/1/1 x | ||||
| #   a  1 | ||||
| #   b | ||||
| 
 | ||||
| # 2010/1/1 y | ||||
| #   c:  1 | ||||
| #   d | ||||
| 
 | ||||
| # >>>2 /line 6, column 5/ | ||||
| # >>>= 1 | ||||
| @ -1,13 +0,0 @@ | ||||
| # this gave a stack space overflow error with 0.8-0.9 due to infinite | ||||
| # recursion in Posting and Transaction's equality tests: | ||||
| hledgerdev -f - balance | ||||
| <<< | ||||
| i 2010/1/1 09:00:00 a:b | ||||
| o 2010/1/1 09:03:00 | ||||
| >>>=0 | ||||
| # incidentally this didn't trigger it.. go figure | ||||
| #hledgerdev -f - balance | ||||
| #<<< | ||||
| #i 2010/1/1 09:00:00 a:b | ||||
| #o 2010/1/1 09:02:00 | ||||
| #>>>=0 | ||||
							
								
								
									
										22
									
								
								tests/timelog/timezone.test.notimplemented
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								tests/timelog/timezone.test.notimplemented
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| # timezone-related tests | ||||
| # 1. as in ledger, historical prices may contain a time and timezone. | ||||
| # hledger ignores them and uses 00:00 local time instead. | ||||
| # XXX needs --value not --cost | ||||
| hledgerdev -f - balance --no-total --cost | ||||
| <<< | ||||
| P 2011/01/01 00:00:00      A $1 | ||||
| P 2011/01/01 15:00:00-0100 A $2 | ||||
| 
 | ||||
| 2010/12/31 | ||||
|   (20101231)  1 A | ||||
| 
 | ||||
| 2011/1/1 | ||||
|   (20110101)  1 A | ||||
| 
 | ||||
| 2011/1/2 | ||||
|   (20110102)  1 A | ||||
| >>> | ||||
|                  1 A  20101231 | ||||
|                   $2  20110101 | ||||
|                   $2  20110102 | ||||
| >>>=0 | ||||
| @ -1,22 +0,0 @@ | ||||
| # timezone-related tests | ||||
| # 1. as in ledger, historical prices may contain a time and timezone. | ||||
| # hledger ignores them and uses 00:00 local time instead. | ||||
| # XXX needs --value not --cost | ||||
| # hledgerdev -f - balance --no-total --cost | ||||
| # <<< | ||||
| # P 2011/01/01 00:00:00      A $1 | ||||
| # P 2011/01/01 15:00:00-0100 A $2 | ||||
| 
 | ||||
| # 2010/12/31 | ||||
| #   (20101231)  1 A | ||||
| 
 | ||||
| # 2011/1/1 | ||||
| #   (20110101)  1 A | ||||
| 
 | ||||
| # 2011/1/2 | ||||
| #   (20110102)  1 A | ||||
| # >>> | ||||
| #                  1 A  20101231 | ||||
| #                   $2  20110101 | ||||
| #                   $2  20110102 | ||||
| # >>>=0 | ||||
| @ -1,13 +0,0 @@ | ||||
| # a zero amount is always displayed as just "0", regardless of any commodity/decimal places/price (like ledger) | ||||
| # | ||||
| hledgerdev -f- print --empty | ||||
| <<< | ||||
| 2010/3/1 x | ||||
|   a  $0.00 @ 3EUR | ||||
|   b | ||||
| >>> | ||||
| 2010/03/01 x | ||||
|     a             0 | ||||
|     b             0 | ||||
| 
 | ||||
| >>>=0 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user