-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make asserting failed exit codes and output nicer #336
Make asserting failed exit codes and output nicer #336
Conversation
And if there is any output (by a lazy eval as last parameter) that will be rendered into the stdout
echo output to stdout if last arg start with eval on standalone assertions
Adding full control over the stdout and stderr
I have some ideas about this (which you don't have to follow but maybe just think about the direction):
Does -a exit_code imply the thing in double quotes is going to be run as command? Also trying to think of some other combinations that either need to mean something, or they need to error. What would this do?
The 2nd argument can just be a normal string. I think special strings shouldn't switch the behaviour of the command. My preferred syntax would be to have:
It'd mean that bashunit would run the command and then assert what we ask it to assert. Right now the only assertion would be exit code:
Maybe other asserts could work on the output automatically?
Also it'd be nice to save the output to a variable with another option for further asserts:
|
I like your proposal of removing eval from the second string passed to the exit_code:
Basically, the change I would suggest/do is to keep the same behavior (no need to introduce PS: after some rethinking, I find these two ideas very interesting. I will investigate deeper into what possibilities do we have to get something like this, but in a follow up PR to not overcomplicate/delay this one. Ideas to investigate
I would discard (at least for now) the
|
64532a3
to
8abe438
Compare
📚 Description
Closes: #334
🔖 Changes
exit_code
by passing the callable command to evaluate as raw string instead of$(...)
🖼️ Demo
Render the stdout in the terminal and the errors in a file
✅ To-do list
CHANGELOG.md
to reflect the new feature or fix