-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Conversation
raise ArgumentError, message: "Unexpected:\n#{inspect(arg)}" | ||
end | ||
end | ||
|> ExUnit.BeamHelpers.write_beam() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
lib/ex_unit/lib/ex_unit/doc_test.ex
Outdated
case String.replace_suffix(expected, "...", "") do | ||
^expected -> false |
There was a problem hiding this comment.
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>
Close #14210