hledger/tests
2019-11-23 12:54:34 -08:00
..
addons update addons tests, note a todo 2017-03-29 08:21:30 -07:00
balance cli: Add -% to compound balance commands 2019-11-18 17:10:59 -08:00
cli ;lib: store raw opts unquoted 2019-10-19 14:44:08 -07:00
i18n ;tests: normalize tests, examples, and docs using 2spcs before comments 2019-06-13 12:12:21 -07:00
journal cli: anonymize transaction code also 2019-11-18 17:42:22 -08:00
print ;tests: consolidate query tests slightly 2019-07-26 23:22:46 +01:00
register reg: test and fix for --average, broken since 1.12 (#1003) 2019-04-06 11:00:38 -07:00
0unittests.test ;tests: move 0unittests up, delete unused examples symlink 2019-07-08 08:02:54 +01:00
account-aliases.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
accounts-sorting.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
accounts.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
add.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
amount-rendering.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
balancesheet.test bs: show end date(s) in title, not transactions date span (#1078) 2019-08-15 18:22:23 +01:00
cashflow.test bs: show end date(s) in title, not transactions date span (#1078) 2019-08-15 18:22:23 +01:00
close.test close: preserve transaction prices (costs) accurately (#1035) 2019-07-09 11:21:22 +01:00
csv.test ;csv: another commented test for auto-generation of balancing posting 2019-11-23 12:54:34 -08:00
descriptions.test payees: Split command into descriptions, payees, and notes 2019-07-15 08:22:16 +01:00
forecast.test ;journal: in generated-transaction:/posting: tags, add a space before the value 2019-10-07 14:54:36 -10:00
hledger-csv test: updated csv parser tests to nicer format 2019-11-05 21:16:42 +00:00
incomestatement.test cli: Add -% to compound balance commands 2019-11-18 17:10:59 -08:00
notes.test payees: Split command into descriptions, payees, and notes 2019-07-15 08:22:16 +01:00
payees.test payees: Split command into descriptions, payees, and notes 2019-07-15 08:22:16 +01:00
pivot.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
prices.test prices: style price amounts; always show full precision 2019-10-20 07:09:34 -07:00
query-desc.test ;tests: consolidate query tests slightly 2019-07-26 23:22:46 +01:00
query-tag.test ;tests: fix query-tag test 2019-07-27 06:51:15 +01:00
README.md doc: add a README for the functional tests, linked from contrib guide 2019-04-19 09:56:33 -07:00
rewrite.test ;journal: in generated-transaction:/posting: tags, add a space before the value 2019-10-07 14:54:36 -10:00
roi.test lib: roi does not fail on empty input data (+test) 2019-11-18 16:13:04 -08:00
sample.journal ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
stats.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00
tags.test tags: add --values flag 2019-07-26 23:18:21 +01:00
timeclock.test ;tests: flatten functional test files a bit 2019-07-08 08:28:03 +01:00

hledger's functional tests. See also Contributor Guide: Tests.

These mainly test the hledger CLI and (indirectly) hledger-lib. They are organised roughly by component.

Running these requires shelltestrunner. Older test files are in format 1; newer ones use format 3 (preferred). Some tests invoke unix commands so will not run in a Windows CMD shell.

Run them all (also builds hledger):

make functest

See how the Makefile is invoking shelltestrunner:

$ make functest -n
stack build --fast hledger
(COLUMNS=80 stack exec -- shelltest --execdir -j16 --hide-successes --exclude=/_ -w `stack exec -- which hledger` tests \
        && echo functest PASSED) || (echo functest FAILED; false)

These are the most important:

  • COLUMNS=80 makes output independent of your terminal width.
  • --execdir runs each test within its own directory.
  • -w `stack exec -- which hledger` ensures you are testing the hledger executable that was just built.
  • -j16 runs tests in parallel which is much faster.

Run only the tests matching a regular expression:

$ COLUMNS=80 shelltest --execdir -w `stack exec -- which hledger` tests -i balance-assertions.*19
:tests/journal/balance-assertions.test:19: [OK]

         Test Cases  Total      
 Passed  1           1          
 Failed  0           0          
 Total   1           1          

Run only the tests in one file:

$ COLUMNS=80 shelltest --execdir -w `stack exec -- which hledger` tests/cli/query-args.test
:tests/cli/query-args.test:1: [OK]
:tests/cli/query-args.test:2: [OK]
:tests/cli/query-args.test:3: [OK]

         Test Cases  Total      
 Passed  3           3          
 Failed  0           0          
 Total   3           3          

Run a test repeatedly as its file is changed:

$ ls tests/cli/query-args.test | entr bash -c "COLUMNS=80 shelltest --execdir -w `stack exec -- which hledger` tests/cli/query-args.test -i1"
:tests/cli/query-args.test:1: [OK]

         Test Cases  Total      
 Passed  1           1          
 Failed  0           0          
 Total   1           1          
:tests/cli/query-args.test:1: [OK]

         Test Cases  Total      
 Passed  1           1          
 Failed  0           0          
 Total   1           1          
  C-c C-c

More shelltestrunner options:

$ shelltest --help