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

Support ellipsis in doctest exceptions #14233

Merged
merged 4 commits into from
Jan 28, 2025

Conversation

sabiwara
Copy link

Close #14210

Screenshot 2025-01-28 at 8 44 16

raise ArgumentError, message: "Unexpected:\n#{inspect(arg)}"
end
end
|> ExUnit.BeamHelpers.write_beam()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test when the error message itself has "..." at the end?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 468bfbc.
I'm not sure it's too useful since technically if we allow for anything then there's little reason for ... not to pass, but it doesn't cost much to have it so I'm fine either way.

Comment on lines 607 to 608
case String.replace_suffix(expected, "...", "") do
^expected -> false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an expensive check to verify if the string has ... or not. My suggestion is to use String.ends_with? and then binary_slice.

Co-authored-by: José Valim <jose.valim@gmail.com>
@sabiwara sabiwara merged commit 4087560 into elixir-lang:main Jan 28, 2025
8 of 9 checks passed
@sabiwara sabiwara deleted the doctest-ellipsis branch January 28, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

doctest cannot match on exceptions with blank lines in them
2 participants