-
Notifications
You must be signed in to change notification settings - Fork 502
Adjust test outputs in test/examples to avoid warnings; fix bug in expandfirst handling on Windows
#2804
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
Adjust test outputs in test/examples to avoid warnings; fix bug in expandfirst handling on Windows
#2804
Changes from all commits
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 |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ Pages = ["man/tutorial.md"] | |
| ```@index | ||
| ``` | ||
|
|
||
| ### Embedded `@ref` links headers: [`ccall`](@ref) | ||
| ### Embedded `@ref` links headers: [`deepcopy`](@ref) | ||
|
|
||
| [#60](@ref) [#61](@ref) | ||
|
|
||
|
|
@@ -45,7 +45,7 @@ end | |
|
|
||
| ```jldoctest | ||
| julia> [1.0, 2.0, 3.0] | ||
| 3-element Array{Float64,1}: | ||
| 3-element Vector{Float64}: | ||
mortenpi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 1.0 | ||
| 2.0 | ||
| 3.0 | ||
|
|
@@ -199,7 +199,7 @@ julia> g(2) | |
| ``` | ||
| ```jldoctest | ||
| julia> f(2) | ||
| ERROR: UndefVarError: f not defined | ||
| ERROR: UndefVarError: `f` not defined in `Main` | ||
mortenpi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ```jldoctest PR650; setup = :(f(x) = x^2; g(x) = x) | ||
|
|
@@ -264,7 +264,7 @@ julia> t = T() | |
| T() | ||
|
|
||
| julia> fullname(@__MODULE__) | ||
| (:Main,) | ||
| (:Main, :Main) | ||
|
Collaborator
Author
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. I am unsure how this was ever correct... I mean, yeah, ideally it would print C.f.: julia> fullname(@__MODULE__)
(:Main,)
julia> module Foo println(fullname(@__MODULE__)) end
(:Main, :Foo)
Main.Foo
Member
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. We try to fix some of these things up though. I wonder if this regressed at some point..
Collaborator
Author
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. Possibly but I see nothing in the code that would fix this. Anyway, if this ever worked (and I am not convinced it did, but I am also too lazy to try to reconstruct the exact setup from when this test was added), then it must have been quite some time ago. That's part of the problem this PR was meant to fix: the tests in there did not actually act as tests because except for the gravest kinds of failures (crashes, hard exceptions) any regressions were ignored :-(. I think the current behavior is OK -- if someone really wants to print the
Member
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. Yep, agreed. |
||
|
|
||
| julia> fullname(Base.Broadcast) | ||
| (:Base, :Broadcast) | ||
|
|
@@ -273,7 +273,7 @@ julia> @__MODULE__ | |
| Main | ||
| ``` | ||
|
|
||
| # Issue398 | ||
| # Issue #398 | ||
|
Collaborator
Author
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. That's just for consistency (I am also tempted to sort these sections by issue number... or maybe each issue test should be in a file of its own? |
||
|
|
||
| ```@meta | ||
| DocTestSetup = quote | ||
|
|
@@ -309,7 +309,7 @@ abcd | |
| DocTestSetup = nothing | ||
| ``` | ||
|
|
||
| # Issue653 | ||
| # Issue #653 | ||
|
|
||
| ```jldoctest | ||
| julia> struct MyException <: Exception | ||
|
|
@@ -331,16 +331,19 @@ julia> throw(MyException("test exception")) | |
| ERROR: MyException: test exception | ||
| ``` | ||
|
|
||
| # Issue418 | ||
| # Issue #418 | ||
|
|
||
| ```jldoctest | ||
| julia> f(x::Float64) = x | ||
| f (generic function with 1 method) | ||
|
|
||
| julia> f("") | ||
| ERROR: MethodError: no method matching f(::String) | ||
| The function `f` exists, but no method is defined for this combination of argument types. | ||
|
Collaborator
Author
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. This line is new in Julia 1.11 |
||
|
|
||
| Closest candidates are: | ||
| f(!Matched::Float64) at none:1 | ||
| f(!Matched::Float64) | ||
| @ Main none:1 | ||
| ``` | ||
|
|
||
|
|
||
|
|
@@ -374,6 +377,7 @@ a = 1 | |
| ``` | ||
|
|
||
| # Issue #793 | ||
|
|
||
| ```jldoctest | ||
| julia> write("issue793.jl", "\"Hello!\""); | ||
|
|
||
|
|
@@ -424,7 +428,7 @@ x | |
| @assert x == 1148 | ||
| ``` | ||
|
|
||
| # Issue513 | ||
| # Issue #513 | ||
|
|
||
| ```jldoctest named | ||
| julia> a = 1 | ||
|
|
@@ -434,19 +438,24 @@ julia> ans | |
| 1 | ||
| ``` | ||
|
|
||
| # Filtering of `Main.` | ||
| # Filtering of `Main.` PR #574 | ||
|
|
||
| We filter the string `Main.` in outputs to make the outputs | ||
| look more like they would in the REPL. | ||
|
|
||
| ```jldoctest | ||
| julia> struct Point end; | ||
|
|
||
| julia> println(Point) | ||
| Point | ||
|
|
||
| julia> import Base: sqrt | ||
|
Collaborator
Author
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. This is necessary to make this test pass in Julia >= 1.12 |
||
|
|
||
| julia> sqrt(100) | ||
| 10.0 | ||
|
|
||
| julia> sqrt = 4 | ||
| ERROR: cannot assign variable Base.sqrt from module Main | ||
| ERROR: cannot assign a value to imported variable Base.sqrt from module Main | ||
| ``` | ||
|
|
||
| ```jldoctest | ||
|
|
@@ -463,9 +472,14 @@ julia> g(2, 3.0) | |
| 8.0 | ||
|
|
||
| julia> g(2.0, 3.0) | ||
| ERROR: MethodError: g(::Float64, ::Float64) is ambiguous. Candidates: | ||
| g(x, y::Float64) in Main at none:1 | ||
| g(x::Float64, y) in Main at none:1 | ||
| ERROR: MethodError: g(::Float64, ::Float64) is ambiguous. | ||
|
|
||
| Candidates: | ||
| g(x, y::Float64) | ||
| @ Main none:1 | ||
| g(x::Float64, y) | ||
| @ Main none:1 | ||
|
|
||
| Possible fix, define | ||
| g(::Float64, ::Float64) | ||
| ``` | ||
|
|
@@ -483,12 +497,6 @@ julia> x->x # ignore error on 0.7 | |
| r = :a | ||
| ``` | ||
|
|
||
| # Bad links (Windows) | ||
|
|
||
| * [Colons not allowed on Windows -- `some:path`](some:path) | ||
| * [No "drive" -- `:path`](:path) | ||
| * [Absolute Windows paths -- `X:\some\path`](X:\some\path) | ||
|
|
||
|
Comment on lines
-486
to
-491
Collaborator
Author
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. This test caused a bunch of warnings. And it is unclear to me what it even is supposed to test. It was added in 80721fd from PR #485. My best guess is in commit 80721fd which was part of PR #485 before squashing. It introduces a function if is_windows() && ':' in img.url
Utilities.warn("Invalid local image: colons not allowed in paths on Windows\n '$(img.url)' in $(get(navnode.page))")
return
endThat function is long gone, but a descendant of the code lives on in elseif Sys.iswindows() && ':' in path
@docerror(
doc, :cross_references,
"invalid local link/image: colons not allowed in paths on Windows in $(Documenter.locrepr(page.source))",
link = node
)
return
endSo perhaps this line is about getting coverage for that But despite this, I think it is the right move to remove this here: because right now, the test results in "fake coverage": we wouldn't notice if the test for colons was broken because we ignore the output via So instead, we need a new test which triggers this and then specifically watches out for the result, and checks that it shows a warning/error with the appropriate message. (And that should probably be three tests, one for each instance). As I mentioned elsewhere, I'd like such a setup also for testing the quality of the
Collaborator
Author
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. See PR #2822 |
||
| # Rendering text/markdown | ||
|
|
||
| ```@example | ||
|
|
@@ -505,13 +513,13 @@ MarkdownOnly(""" | |
| # Empty heading | ||
| ## | ||
|
|
||
| # Issue 1392 | ||
| # Issue #1392 | ||
|
|
||
| ```1392-test-language 1392-extra-info | ||
| julia> function foo end; | ||
| ``` | ||
|
|
||
| # Issue 890 | ||
| # Issue #890 | ||
|
|
||
| I will pay \$1 if $x^2$ is displayed correctly. People may also write \$s or | ||
| even money bag\$\$. | ||
|
|
||
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.
So this uncovered a genuine bug in
expandfirsthandling on Windows, yay. I've thus added a changelog entry. (And fixed the link in the entry above)