-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -548,6 +548,26 @@ defmodule ExUnit.DocTestTest.PatternMatching do | |
end | ||
|> ExUnit.BeamHelpers.write_beam() | ||
|
||
defmodule ExUnit.DocTestTest.Ellipsis do | ||
@doc """ | ||
iex> ExUnit.DocTestTest.Ellipsis.same_line_err(self()) | ||
** (ArgumentError) Unexpected: ... | ||
""" | ||
def same_line_err(arg) do | ||
raise ArgumentError, message: "Unexpected: #{inspect(arg)}" | ||
end | ||
|
||
@doc """ | ||
iex> ExUnit.DocTestTest.Ellipsis.multi_line_err(self()) | ||
** (ArgumentError) Unexpected: | ||
... | ||
""" | ||
def multi_line_err(arg) do | ||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Added in 468bfbc. |
||
|
||
defmodule ExUnit.DocTestTest do | ||
use ExUnit.Case | ||
|
||
|
@@ -574,6 +594,8 @@ defmodule ExUnit.DocTestTest do | |
doctest ExUnit.DocTestTest.HaikuIndent4UsingInspectOpts, | ||
inspect_opts: [custom_options: [indent: 4]] | ||
|
||
doctest ExUnit.DocTestTest.Ellipsis | ||
|
||
import ExUnit.CaptureIO | ||
|
||
test "multiple functions filtered with :only" do | ||
|
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
.