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

doc: fix outdated output msg in the assert example [av skip] #13928

Merged
merged 2 commits into from
Nov 9, 2015

Conversation

gloine
Copy link
Contributor

@gloine gloine commented Nov 9, 2015

This is a minor fix:

macro assert(ex)
    return :($ex ? nothing : error("Assertion failed: ", $(string(ex))))
end

gives me

julia> @assert 1==0
ERROR: Assertion failed: 1 == 0

but the current documentation says

julia> @assert 1==0
ERROR: AssertionError: 1 == 0

which could be confusing for beginners like me. :)

@@ -545,7 +545,7 @@ This macro can be used like this:
julia> @assert 1==1.0

julia> @assert 1==0
ERROR: AssertionError: 1 == 0
ERROR: Assertion failed: 1 == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

This would cause the doctest to fail, since the doctest does not include the above section that defines a new @assert macro. So it's instead calling the built-in @assert macro. Maybe we could modify the above macro definition to be more consistent and say throw(AssertionError($(string(ex)))) instead of error("Assertion failed: ", $(string(ex))) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tried to modify the example as you suggested and make the rest of the document be consistent with the modification. Hope it works...

vtjnash added a commit that referenced this pull request Nov 9, 2015
doc: fix outdated output msg in the assert example [av skip]
@vtjnash vtjnash merged commit 6794483 into JuliaLang:master Nov 9, 2015
@tkelman tkelman added docs This change adds or pertains to documentation backport pending 0.4 labels Nov 9, 2015
@jakebolewski
Copy link
Member

Thanks @gloine!

@gloine gloine deleted the fix/minor-doc-fix-metaprogramming branch November 14, 2015 14:18
tkelman pushed a commit that referenced this pull request Nov 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants