From 5d2f9d742a73d9c5cfd48c7c1cf15e995f3a0023 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 29 Mar 2017 06:39:30 -0700 Subject: [PATCH] test: cli: test stderr for more verbose failures --- tests/cli/cli.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/cli/cli.test b/tests/cli/cli.test index 88a7de670..a4d855dcc 100644 --- a/tests/cli/cli.test +++ b/tests/cli/cli.test @@ -62,11 +62,13 @@ # 1. --version shows version hledger --version >>> /^hledger [0-9]/ +>>>2 >>>=0 # 2. --version also works after a command, if it's internal hledger balance --version >>> /^hledger [0-9]/ +>>>2 >>>=0 # help @@ -74,31 +76,37 @@ hledger balance --version # 3. with no command, show commands list hledger >>> /^Commands available/ +>>>2 >>>=0 # 4. no-command help still works if there are flags, at least the common ones hledger -fsomefile >>> /^Commands available/ +>>>2 >>>=0 # 5. and also with a space between flag and value hledger -f somefile >>> /^Commands available/ +>>>2 >>>=0 # 6. with -h, and possibly other common flags present, show general usage hledger -h --version -f /dev/null >>> /^hledger \[CMD\]/ +>>>2 >>>=0 # 7. with -h before COMMAND, show general usage hledger -h balance --cost >>> /^hledger \[CMD\]/ +>>>2 >>>=0 # 8. with -h after command, show command usage hledger balance -h >>> /balance \[OPTIONS\]/ +>>>2 >>>=0 # 9. with an unrecognised command, give an error and non-zero exit status @@ -112,21 +120,25 @@ hledger nosuchcommand # 10. general flags can go before command hledger -f /dev/null --alias somealiases --rules-file -h --help --version --debug 1 --daily register >>> /^hledger \[CMD\]/ +>>>2 >>>=0 # 11. or after it, and spaces in options are optional hledger register -f/dev/null --alias=somealiases --rules-file -h --version --debug 1 --daily >>> /^register \[OPTIONS\]/ +>>>2 >>>=0 # 12. general flags before command should work hledger -f /dev/null --daily register >>> +>>>2 >>>=0 # 13. command-specific flags can go after command hledger -f /dev/null register --daily >>> +>>>2 >>>=0 # 14. but not before it