Closed Martoon-00 closed 5 years ago
I think it makes sense to add a test where you call error
, then catch ErrorCall
and check that the second String
in ErrorCallWithLocation
contains expected number of newline characters (AFAIU, 2, if the string passed to error
doesn't have them).
It seems to me, that examining the number of newlines would be more fragile than useful.
Our error
implementation will hardly ever change since now (unless GHC improves error
again). On the other hand, if GHC changes the text of the error, that test case would need to catch up.
I'm not completely sure though, @gromakovsky if you disagree with this point I'll add the test.
There seems to be no way to extract CallStack
from the exception thrown by the error
unfortunately.
Thanks, done.
Description
As we know, our
error
is funny:I hope I fixed it to work as expected:
Called from ghci:
Called from code:
Related issues(s)
No corresponding issue exist.
✓ Checklist for your Pull Request
Ideally a PR has all of the checkmarks set.
If something in this list is irrelevant to your PR, you should still set this checkmark indicating that you are sure it is dealt with (be that by irrelevance).
Related changes (conditional)
Tests
Documentation
I checked whether I should update the docs and did so if necessary:
Record your changes
Stylistic guide (mandatory)
[x] My commit history is clean (only contains changes relating to my issue/pull request and no reverted-my-earlier-commit changes) and commit messages start with identifiers of related issues in square brackets.
Example:
[#42] Short commit description
If necessary both of these can be achieved even after the commits have been made/pushed using rebase and squash.