test: cli: test stderr for more verbose failures
This commit is contained in:
parent
98ca2e965c
commit
5d2f9d742a
@ -62,11 +62,13 @@
|
|||||||
# 1. --version shows version
|
# 1. --version shows version
|
||||||
hledger --version
|
hledger --version
|
||||||
>>> /^hledger [0-9]/
|
>>> /^hledger [0-9]/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 2. --version also works after a command, if it's internal
|
# 2. --version also works after a command, if it's internal
|
||||||
hledger balance --version
|
hledger balance --version
|
||||||
>>> /^hledger [0-9]/
|
>>> /^hledger [0-9]/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# help
|
# help
|
||||||
@ -74,31 +76,37 @@ hledger balance --version
|
|||||||
# 3. with no command, show commands list
|
# 3. with no command, show commands list
|
||||||
hledger
|
hledger
|
||||||
>>> /^Commands available/
|
>>> /^Commands available/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 4. no-command help still works if there are flags, at least the common ones
|
# 4. no-command help still works if there are flags, at least the common ones
|
||||||
hledger -fsomefile
|
hledger -fsomefile
|
||||||
>>> /^Commands available/
|
>>> /^Commands available/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 5. and also with a space between flag and value
|
# 5. and also with a space between flag and value
|
||||||
hledger -f somefile
|
hledger -f somefile
|
||||||
>>> /^Commands available/
|
>>> /^Commands available/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 6. with -h, and possibly other common flags present, show general usage
|
# 6. with -h, and possibly other common flags present, show general usage
|
||||||
hledger -h --version -f /dev/null
|
hledger -h --version -f /dev/null
|
||||||
>>> /^hledger \[CMD\]/
|
>>> /^hledger \[CMD\]/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 7. with -h before COMMAND, show general usage
|
# 7. with -h before COMMAND, show general usage
|
||||||
hledger -h balance --cost
|
hledger -h balance --cost
|
||||||
>>> /^hledger \[CMD\]/
|
>>> /^hledger \[CMD\]/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 8. with -h after command, show command usage
|
# 8. with -h after command, show command usage
|
||||||
hledger balance -h
|
hledger balance -h
|
||||||
>>> /balance \[OPTIONS\]/
|
>>> /balance \[OPTIONS\]/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 9. with an unrecognised command, give an error and non-zero exit status
|
# 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
|
# 10. general flags can go before command
|
||||||
hledger -f /dev/null --alias somealiases --rules-file -h --help --version --debug 1 --daily register
|
hledger -f /dev/null --alias somealiases --rules-file -h --help --version --debug 1 --daily register
|
||||||
>>> /^hledger \[CMD\]/
|
>>> /^hledger \[CMD\]/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 11. or after it, and spaces in options are optional
|
# 11. or after it, and spaces in options are optional
|
||||||
hledger register -f/dev/null --alias=somealiases --rules-file -h --version --debug 1 --daily
|
hledger register -f/dev/null --alias=somealiases --rules-file -h --version --debug 1 --daily
|
||||||
>>> /^register \[OPTIONS\]/
|
>>> /^register \[OPTIONS\]/
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 12. general flags before command should work
|
# 12. general flags before command should work
|
||||||
hledger -f /dev/null --daily register
|
hledger -f /dev/null --daily register
|
||||||
>>>
|
>>>
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 13. command-specific flags can go after command
|
# 13. command-specific flags can go after command
|
||||||
hledger -f /dev/null register --daily
|
hledger -f /dev/null register --daily
|
||||||
>>>
|
>>>
|
||||||
|
>>>2
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 14. but not before it
|
# 14. but not before it
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user