-
Notifications
You must be signed in to change notification settings - Fork 465
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
render exceptions in conditions as condition failure #49
Conversation
Thanks a lot for your pull request. I like the idea, and will review over the weekend. |
@pniederw any review? |
👍 |
I've started work on this pull request, and should have it integrated soon. Thanks for your patience. |
very nice enhancement 👍 |
@pniederw Any progress? |
👍 |
@pniederw Any progress? |
👍 |
1 similar comment
👍 |
@pniederw Why this pull request was not merged yet? Is anything wrong with code? |
@robfletcher Maybe you can have a look a this pull request (as a spock user this seems like a very nice feature)? |
Yeah, this looks excellent. I'm going to merge it if I don't hear a good reason why I shouldn't in the next few hours. |
@robfletcher Did you found "good reason" not to merge? |
Open Question: What to do with invocation of void methods and assignments? Should such constructions became conditions because them can throw an exception. |
Maybe this can be merged before the next release? |
@robfletcher Time flies. Any chance to get it merged in the foreseeable future? |
any update on this? |
…n-failure__over_spock_master render exceptions in conditions as condition failure (copy of #49)
Superseded by #549 which is now merged |
Idea
Spock has the best exception rendering I have ever see. For example, lets take a spec:
It fails and has good rendering:
But how it will be rendered if map miss value for key "responceCode"? For example in this spec:
just an exception:
we can understand that map does not contains entry for "responceCode" but we can not inspect what map really contains.
With my modifications it will become more friendly:
So exceptions that occured during evaluating condition become part of rendering.
Implementation
Lets take for example this condition:
Before my changes it will be transformed to (I omit unnecessary parts)
We need to:
ValueRecorder,startRecording method:
So we add value number to stack before evaluating expression for this value. And remove value number from top of stack when value is written to ValueRecording. And when exception is thrown we can learn where exception is thrown by peeking value from top of stack.