|
40 | 40 | # Its signature is kwarg_decl(m::Method, kwtype::DataType). The second argument |
41 | 41 | # should be the type of the kwsorter from the corresponding MethodTable. |
42 | 42 | @test isa(methods(M.j_1), Base.MethodList) |
43 | | - @test isdefined(methods(M.j_1), :mt) |
44 | | - local mt = methods(M.j_1).mt |
| 43 | + get_mt(func) = VERSION ≥ v"1.13.0-DEV.647" ? Core.GlobalMethods : methods(func).mt |
| 44 | + local mt = get_mt(M.j_1) |
45 | 45 | @test isa(mt, Core.MethodTable) |
46 | 46 | if Base.fieldindex(Core.MethodTable, :kwsorter, false) > 0 |
47 | 47 | @test isdefined(mt, :kwsorter) |
48 | 48 | end |
49 | 49 | # .kwsorter is not always defined -- namely, it seems when none of the methods |
50 | 50 | # have keyword arguments: |
51 | | - @test isdefined(methods(M.f).mt, :kwsorter) === false |
| 51 | + @test isdefined(get_mt(M.f), :kwsorter) === false |
52 | 52 | # M.j_1 has two methods. Fetch the single argument one.. |
53 | 53 | local m = which(M.j_1, (Any,)) |
54 | 54 | @test isa(m, Method) |
|
61 | 61 | # that does not have any arguments |
62 | 62 | m = which(M.j_1, (Any,Any)) # fetch the no-keyword method |
63 | 63 | if VERSION < v"1.4.0-DEV.215" |
64 | | - @test Base.kwarg_decl(m, typeof(methods(M.j_1).mt.kwsorter)) == Tuple{}() |
| 64 | + @test Base.kwarg_decl(m, typeof(get_mt(M.j_1).kwsorter)) == Tuple{}() |
65 | 65 | else |
66 | 66 | @test Base.kwarg_decl(m) == [] |
67 | 67 | end |
|
83 | 83 | DSE.format(IMPORTS, buf, doc) |
84 | 84 | str = String(take!(buf)) |
85 | 85 | @test occursin("\n - `Base`\n", str) |
86 | | - @test occursin("\n - `Core`\n", str) |
| 86 | + if VERSION < v"1.13-DEV" |
| 87 | + @test occursin("\n - `Core`\n", str) |
| 88 | + end |
87 | 89 |
|
88 | 90 | # Module exports. |
89 | 91 | DSE.format(EXPORTS, buf, doc) |
|
151 | 153 | DSE.format(SIGNATURES, buf, doc) |
152 | 154 | str = String(take!(buf)) |
153 | 155 | @test occursin("\n```julia\n", str) |
154 | | - @test occursin("\ng()\n", str) |
155 | | - @test occursin("\ng(x)\n", str) |
| 156 | + # On 1.10+, automatically generated methods have keywords in the metadata, |
| 157 | + # hence the display difference between Julia versions. |
| 158 | + if VERSION >= v"1.10" |
| 159 | + @test occursin("\ng(; ...)\n", str) |
| 160 | + @test occursin("\ng(x; ...)\n", str) |
| 161 | + else |
| 162 | + @test occursin("\ng()\n", str) |
| 163 | + @test occursin("\ng()\n", str) |
| 164 | + end |
156 | 165 | @test occursin("\n```\n", str) |
157 | 166 |
|
158 | 167 | doc.data = Dict( |
|
163 | 172 | DSE.format(SIGNATURES, buf, doc) |
164 | 173 | str = String(take!(buf)) |
165 | 174 | @test occursin("\n```julia\n", str) |
166 | | - @test occursin("\ng()\n", str) |
167 | | - @test occursin("\ng(x)\n", str) |
168 | | - @test occursin("\ng(x, y)\n", str) |
| 175 | + # On 1.10+, automatically generated methods have keywords in the metadata, |
| 176 | + # hence the display difference between Julia versions. |
| 177 | + if VERSION >= v"1.10" |
| 178 | + @test occursin("\ng(; ...)\n", str) |
| 179 | + @test occursin("\ng(x; ...)\n", str) |
| 180 | + @test occursin("\ng(x, y; ...)\n", str) |
| 181 | + else |
| 182 | + @test occursin("\ng()\n", str) |
| 183 | + @test occursin("\ng(x)\n", str) |
| 184 | + @test occursin("\ng(x, y)\n", str) |
| 185 | + end |
169 | 186 | @test occursin("\ng(x, y, z; kwargs...)\n", str) |
170 | 187 | @test occursin("\n```\n", str) |
171 | 188 |
|
|
245 | 262 | str = String(take!(buf)) |
246 | 263 | @test occursin("\n```julia\n", str) |
247 | 264 | if typeof(1) === Int64 |
248 | | - @test occursin("\nh(x::Int64) -> Int64\n", str) |
| 265 | + # On 1.10+, automatically generated methods have keywords in the metadata, |
| 266 | + # hence the display difference between Julia versions. |
| 267 | + if VERSION >= v"1.10" |
| 268 | + @test occursin("\nh(x::Int64; ...) -> Int64\n", str) |
| 269 | + else |
| 270 | + @test occursin("\nh(x::Int64) -> Int64\n", str) |
| 271 | + end |
249 | 272 | else |
250 | | - @test occursin("\nh(x::Int32) -> Int32\n", str) |
| 273 | + # On 1.10+, automatically generated methods have keywords in the metadata, |
| 274 | + # hence the display difference between Julia versions. |
| 275 | + if VERSION >= v"1.10" |
| 276 | + @test occursin("\nh(x::Int32; ...) -> Int32\n", str) |
| 277 | + else |
| 278 | + @test occursin("\nh(x::Int32) -> Int32\n", str) |
| 279 | + end |
251 | 280 | end |
252 | 281 | @test occursin("\n```\n", str) |
253 | 282 |
|
|
671 | 700 | @test occursin("github.com/JuliaDocs/NonExistent", DSE.url(first(methods(M.f)))) |
672 | 701 | @test occursin("github.com/JuliaDocs/NonExistent", DSE.url(first(methods(M.K)))) |
673 | 702 | end |
| 703 | + withenv( |
| 704 | + "TRAVIS_REPO_SLUG" => "JuliaDocs/NonExistent", |
| 705 | + "TRAVIS_COMMIT" => "<commit>", |
| 706 | + "TRAVIS_BUILD_DIR" => dirname(@__DIR__) |
| 707 | + ) do |
| 708 | + @test occursin("github.com/JuliaDocs/NonExistent/tree/<commit>/test/TestModule/M.jl", DSE.url(first(methods(M.f)))) |
| 709 | + end |
674 | 710 | end |
675 | 711 | @testset "comparemethods" begin |
676 | 712 | let f = first(methods(M.f)), |
|
0 commit comments