Skip to content
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

Test on last line of a file missing failure message #211

Closed
benhutchison opened this issue Oct 2, 2020 · 3 comments
Closed

Test on last line of a file missing failure message #211

benhutchison opened this issue Oct 2, 2020 · 3 comments

Comments

@benhutchison
Copy link

I've observed that when a munit test defined on the last line of a test file fails, the failure message is missing all the details. (Using Dotty 0.27). If the tests are re-ordered, the message is displayed normally.

Using debugger I narrowed down what's happening. This line expects slice array to have length 3, In my case, it has length 2.

So it drops through to the end of method and returns empty String as fail message. That in turn is because if location.line is the last line in lines, then taking a slice to location.line + 1 wont add another line to the slice here

Perhaps this shows up more with dotty's optional braces where the test is on the last line of the file?

@benhutchison
Copy link
Author

Workaround: add a comment to line after the last test

@SethTisue
Copy link
Contributor

whoa, nice catch

olafurpg pushed a commit to olafurpg/munit that referenced this issue Oct 19, 2020
@olafurpg
Copy link
Member

Thank you for reporting! I am able to reproduce. I opened #226 with a fix for this bug.

olafurpg added a commit that referenced this issue Oct 19, 2020
Fix #211, handle test case on last line in the source file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants