-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add raw string compare in doctests for #Module<...> #1943
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
Conversation
lib/ex_unit/lib/ex_unit/doc_test.ex
Outdated
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 may look like a hack but the resulting error message is really nice:
** (ExUnit.ExpectationError)
expected doctest: inspect (HashDict.new d: 3, e: 4, f: 5)
to evaluate to: "#HashDict<[a: 0, b: 1, c: 2]>"
instead got: "#HashDict<[d: 3, e: 4, f: 5]>"
You see exactly what is happening.
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.
Looks nice. We just need to remove the space in between inspect and ( or get rid of parentheses.
|
Forgot docs, hold on. |
|
Added docs. |
|
👍 |
|
Seems to have a typo "<[" closed as "]" |
|
@Nami-Doc Thank you. Apparently the DocTest module isn't doctested, go figure. I also made Version use the new feature. Any other modules that may use this? |
lib/ex_unit/lib/ex_unit/doc_test.ex
Outdated
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.
Why are we stripping? I don't think it is a good idea. Imagine this:
iex> """
...> hello
...> """
Will now do raw string compare for doctests of #Module<...> format:
iex> HashDict.new a: 0, b: 1, c: 2
#HashDict<[a: 0, b: 1, c: 2]>
|
There was actually a problem with just prepending the expression string with |
Add raw string compare in doctests for #Module<...>
Will now do raw string compare for doctests of #Module<...> format: