-
Notifications
You must be signed in to change notification settings - Fork 107
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
Include file/line/column of failed assertion in output? #306
Comments
I believe if you search for Haha with a complex enough multiline regex I think we could do what you want already (looking for the arrows) but perhaps we could make that a little easier. I could imagine we might be able to put it in the header line e.g:
Not sure if that's better or not than a separate printout. |
That would absolutely work! As long as it's fine that |
yeah both sets of information should be available, so would be up to you to pick the right one, I'm happy for it to be where the error occurred |
there is also the possibility that there are other code blocks / functions are printed, like if you for those auxiliary code blocks I would expect they wouldn't have the |
Yeah, that sort of suggests that the line/column printout should be separate. I'm a bit weary about conflating the pretty code listings with this information. |
Yeah so I trust you'll preserve the aesthetics as best you can! I'm happy for you to experiment and come up with something you think looks nice. |
Something like this could work, after the failed after 4 tests and 1 shrink line (example from https://teh.id.au/posts/2017/07/15/state-machine-testing/):
with the |
Yeah that's nice, I would try some variations too and see how they look:
|
I think I like number 4 the most. |
Fixes hedgehogqa#306. Adds the location of the failed assertion (taken from the Span value of the failure report). Example output: ``` ✗ <interactive> failed at test/Test/Hedgehog/Applicative.hs:91:11 after 1 test. ┏━━ test/Test/Hedgehog/Applicative.hs ━━━ 69 ┃ ... ``` This enables editors to easily parse the location of failed test assertions and provide links/jump functionality.
* Include location of failed assertion in report Fixes #306. Adds the location of the failed assertion (taken from the Span value of the failure report). Example output: ``` ✗ <interactive> failed at test/Test/Hedgehog/Applicative.hs:91:11 after 1 test. ┏━━ test/Test/Hedgehog/Applicative.hs ━━━ 69 ┃ ... ``` This enables editors to easily parse the location of failed test assertions and provide links/jump functionality. * Match style guide
Hi! This is going to sound like a very Emacs-specific problem, but please bear with me. 🙂
I'm using Hedgehog a lot through Emacs' compilation-mode (or the haskell-compilation buffer, to be specific). I was trying to add a pattern to
haskell-compilation-error-regexp-alist
, which would let me navigate between failed tests using the regular "previous/next error" functions in Emacs.The problem is that Hedgehog's output is awesome for human consumption, but not so much for Emacs consumption as it doesn't support multi-line error matchers. Even if it did, I couldn't come up with a reliable way of parsing file, line, and column information.
Would it make sense to add, somewhere in the output of a failing test, a line like:
Or, in case the test threw some exception:
That would be much more tractable to parse in Emacs (and I guess in other editors, recalling my fun days with Vim's
errorformat
).Outstanding questions that I can come up with:
I'd be happy to put together a PR after we've discussed options.
Thanks!
The text was updated successfully, but these errors were encountered: