-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add some doctest to test #22287
add some doctest to test #22287
Conversation
doc/src/stdlib/test.md
Outdated
julia> @test foo("bar") == 9 | ||
Test Passed | ||
Expression: foo("bar") == 9 | ||
Evaluated: 9 == 9 | ||
|
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.
are all the extra blank lines needed for this to pass?
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.
They exist in the output.
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.
is that a bug?
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.
Not sure if you could call it a bug but it is not pretty at least.
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 wrong, anyone know what's causing it?
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.
diff --git a/base/test.jl b/base/test.jl
index c841552..25ab49f 100644
--- a/base/test.jl
+++ b/base/test.jl
@@ -69,9 +69,9 @@ struct Pass <: Result
value
end
function Base.show(io::IO, t::Pass)
- print_with_color(:green, io, "Test Passed\n"; bold = true)
+ print_with_color(:green, io, "Test Passed"; bold = true)
if !(t.orig_expr === nothing)
- print(io, " Expression: ", t.orig_expr)
+ print(io, "\n Expression: ", t.orig_expr)
end
if t.test_type == :test_throws
# The correct type of exception was thrown
?
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.
Yeah, makes sense.
Can we merge this? |
Probably. |
1b49bcb
to
4ef09d3
Compare
Pushed @fredrikekre commit and updated doctests. Should be good to go. |
@@ -68,23 +68,25 @@ julia> @test foo(:cat) == 1 | |||
Error During Test | |||
Test threw an exception of type MethodError | |||
Expression: foo(:cat) == 1 | |||
MethodError: `length` has no method matching length(::Symbol) |
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 this block go in the same jldoctest set?
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.
No because the stacktrace is very weird from how Documenter evaluates things in its own module.
doc/src/stdlib/test.md
Outdated
julia> @test_throws MethodError foo(:cat) | ||
Test Passed | ||
Expression: foo(:cat) | ||
Evaluated: MethodError | ||
|
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 this blank line still be here?
doc/src/stdlib/test.md
Outdated
in do_test at test.jl:53 | ||
Test Failed | ||
Expression: 1 ≈ 0.999999 | ||
Evaluated: 1 isapprox 0.999999 |
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.
likely needs updating for #22296
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.
Thanks, I messed up when running the doctests (they didnt actually get run) so I will rebase master and make sure everything passes.
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.
Actually this was corrected as part of #22315
4ef09d3
to
b909ee5
Compare
Doctests for this file now passes locally. |
b909ee5
to
a478a0a
Compare
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.
lgtm! :)
* fix spurious newlines in Base.Test printing * add some doctest to test (cherry picked from commit 2796b40)
* fix spurious newlines in Base.Test printing * add some doctest to test (cherry picked from commit 2796b40)
* fix spurious newlines in Base.Test printing * add some doctest to test (cherry picked from commit 2796b40)
No description provided.