-
Notifications
You must be signed in to change notification settings - Fork 79
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
cmd/testscript: add a -continue flag to not stop at the first error #189
Conversation
32e554d
to
da4eb80
Compare
@mvdan I helped out in a small way by adding a test :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo one suggestion for a slight test improvement, thanks (and good catch on runT
!)
I did forget a test, didn't I :) |
da4eb80
to
45ae1ac
Compare
This helps with writing and running bug reproducers using testscript. Since they are often meant to represent the desired behavior, and not the current behavior, they are designed to fail. However, some reproducers consist of multiple commands, and cmd/testscript would stop at the first command to error. When running a reproducer which is designed to fail, we want to run the entire script and see all failures. Add a `-continue` flag which does just that. With it, `T.FailNow` still marks the test as failed, but does not stop its execution via a panic. We also make two small changes to behave correctly when we reach the end of a script but `T.Failed` is true; we should "FAIL" rather than "PASS". The previous code only reached that point if no errors had happened. Note that we also altered `runT` to use pointer method receivers. It used atomics to modify and read its `failed` field, but without pointer receivers, `T.Failed` always returned false. It appears that bug had been present for a long time. Co-Authored-By: Paul Jolly <paul@myitcv.io>
45ae1ac
to
5cef7b9
Compare
Thanks! Will merge on green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But I'm biased, because I helped write the test :)
The flag was added in #189 but not documented in the usage message.
The flag was added in #189 but not documented in the usage message.
(see commit message)