-
Notifications
You must be signed in to change notification settings - Fork 413
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
Should we use run =X? #479
Comments
I still like just plain |
Thanks for the feedback @edsantiago. What about the other options? Do you find IMHO, |
Are you asking about zero specifically, or any exit code? Zero-specific: In our environment, 0 is assumed. N-general: I'll admit it takes a little getting used to |
Any form of exit code. Just to put up some other ideas:
|
I'm only just getting up to speed on the thread of related issues, but I feel like I'm missing the point. Why are we "upgrading" the I believe its original purpose was to run a command in such a way that the results (output and exit status) can be inspected. having it also take in expected exit status codes, it's now doing two jobs: invoking the subject under test and also doing assertions. It seems contrary to most testing frameworks for the "act" step (in AAA parlance) to have built-in assertions. I think the problem we're having with how to cleanly and clearly provide an expected status code is a side effect of trying to have run take part in both the Act and Assert steps when it should not. |
As I see it, this is the convergence of multiple efforts:
If the preexisting code is still working, I don't see an issue with adding functionality. However, I must admit that mixing two responsibilities might not be the best solution. Yet, I think that point 3 from above should merit some consideration. There is a PR in the making for storing the command that was
Then we're already in trouble due to
I think the two are only related in so far as the more explicit options bloat an already long command. Admittedly, this is not a problem for As I said above, what do you think of moving assert_success/failure into core and adding the failing command as additional context? @jasonkarns |
I'd rather have this fixed this in shellcheck, if at all possible, as |
@kolyshkin Patching this in shellcheck will be a steep uphill battle. The checks might be deeply ingrained and shellcheck is written in Haskell... I already made a PR for transitioning to the What bothers me most with the shellcheck venue is that it is optional. Since bats syntax is a relatively recent addition, there will be many projects around that don't use it because they either don't know or cannot migrate because their suite is too big and full of warnings. Currently, I am tending towards Apart from that I'd also like your input on the AAA debate: Should we avoid checking the return code in |
Time is running up on the 1.5.0 release and we should resolve this before the release. @kolyshkin @edsantiago What do you think of my @jasonkarns I assume you are still opposed on grounds of AAA but you did not reply to my answer comment. |
I actually find |
I think shellcheck is right to complain about this. Carving out an exception for run= in bats scripts does not seem worth it for me. I find the lack of common prefix annyoing to parse with the I only dislike two things about |
Since there was no further feedback I am going down the -N route. Maybe we'll find something better later but this should be good enough for now and should be easily maintainable for longterm backwards-compatibility. |
After landing #367 and rebasing #477 onto it, I got a host of shellcheck warnings for the new
run =<N>
syntax along the lines of:My decision to use
=
was that it is concise and I wanted to avoidrun '=0'
. However, seeing this warning made me acutely aware of the ramifications. Missing the space would assignrun=0
and works without error because the next part is a command that should be runnable.I see following ways going forward:
run '=0'
run ?0
andrun ==0
, which also give shellcheck warnings but at least would not fail silently when omitting the space)run =0
and update shellcheck to balk atrun=0
and don't balk atrun =0
in bats testsPinging @edsantiago since you floated other ideas in the original PR.
I am giving this some urgency since I want to settle the issue before
run =<N>
gets published in the next release.The text was updated successfully, but these errors were encountered: