@@ -52,7 +52,11 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
5252 @test startswith (src, " @inline" )
5353 @test line == 16
5454 @test @code_string (multilinesig (1 , " hi" )) == src
55- @test_throws ErrorException (" no unique matching method found for the specified argument types" ) @code_string (multilinesig (1 , 2 ))
55+ if Base. VERSION < v " 1.11.0-0"
56+ @test_throws ErrorException (" no unique matching method found for the specified argument types" ) @code_string (multilinesig (1 , 2 ))
57+ else
58+ @test_throws " but no method is defined for this combination of argument types" @code_string (multilinesig (1 , 2 ))
59+ end
5660
5761 m = first (methods (f50))
5862 src, line = definition (String, m)
@@ -78,7 +82,8 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
7882 io = PipeBuffer ()
7983 show (io, info)
8084 str = read (io, String)
81- @test startswith (str, " PkgFiles(CodeTracking [da1fd8a2-8d9e-5ec2-8556-3022fb5608a2]):\n basedir:" )
85+ @test startswith (str, " PkgFiles(CodeTracking [da1fd8a2-8d9e-5ec2-8556-3022fb5608a2]):\n basedir:" ) ||
86+ startswith (str, " PkgFiles(Base.PkgId(Base.UUID(\" da1fd8a2-8d9e-5ec2-8556-3022fb5608a2\" ), \" CodeTracking\" )):\n basedir:" )
8287 ioctx = IOContext (io, :compact => true )
8388 show (ioctx, info)
8489 str = read (io, String)
@@ -132,7 +137,9 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
132137 idx = findfirst (lin -> String (lin. file) != @__FILE__ , src. linetable)
133138 lin = src. linetable[idx]
134139 file, line = whereis (lin, m)
135- @test endswith (file, String (lin. file))
140+ if ! Sys. iswindows ()
141+ @test endswith (file, String (lin. file))
142+ end
136143
137144 # Issues raised in #48
138145 m = @which (sum ([1 ]; dims= 1 ))
@@ -247,6 +254,12 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
247254 src, line = definition (String, m)
248255 @test occursin (" (::Type{T})(itr) where {T<:Invert}" , src)
249256 @test line == 126
257+ m = @which MyArray1 {Float64, 1} (undef, 5 )
258+ src, line = definition (String, m)
259+ @test occursin (" (self::Type{MyArray1{T,1}})(::UndefInitializer" , src)
260+ m = @which MyArray2 {Float64, 1} (undef, 5 )
261+ src, line = definition (String, m)
262+ @test occursin (" (::Type{MyArray2{T,1}})(::UndefInitializer" , src)
250263
251264 # Invalidation-insulating methods used by Revise and perhaps others
252265 d = IdDict {Union{String,Symbol},Union{Function,Vector{Function}}} ()
@@ -256,13 +269,13 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
256269 # Issue 115, Cthulhu issue 404
257270 m = @which (Vector)(Int[])
258271 src, line = definition (String, m)
259- @test occursin (" (Array{T,N} where T)(x::AbstractArray{S,N}) where {S,N}" , src)
272+ @test occursin (filter ( ! isspace, " (Array{T,N} where T)(x::AbstractArray{S,N}) where {S,N}" ), filter ( ! isspace, src) )
260273 @test line == m. line
261274
262275 # Issue 115, Cthulhu issue 474
263- m = @which NamedTuple {(),Tuple{}} (())
276+ m = @which MyNamedTuple {(),Tuple{}} (())
264277 src, line = definition (String, m)
265- @test occursin (" NamedTuple {names, T}(args::T) where {names, T <: Tuple}" , src)
278+ @test occursin (" MyNamedTuple {names, T}(args::T) where {names, T <: Tuple}" , src)
266279 @test line == m. line
267280
268281 # Parsed result gives a symbol instead of expression
@@ -293,11 +306,13 @@ end
293306 @test occursin (String (m. file), String (body. args[idx]. file))
294307 @test ex == code_expr (gcd, Tuple{Int,Int})
295308
296- m = first (methods (edit))
297- sigs = signatures_at (String (m. file), m. line)
298- @test ! isempty (sigs)
299- sigs = signatures_at (Base. find_source_file (String (m. file)), m. line)
300- @test ! isempty (sigs)
309+ if Base. VERSION < v " 1.11.0-0"
310+ m = first (methods (edit))
311+ sigs = signatures_at (String (m. file), m. line)
312+ @test ! isempty (sigs)
313+ sigs = signatures_at (Base. find_source_file (String (m. file)), m. line)
314+ @test ! isempty (sigs)
315+ end
301316
302317 # issue #23
303318 @test ! isempty (signatures_at (" script.jl" , 9 ))
384399 return m
385400 end"""
386401 body, _ = CodeTracking. definition (String, @which Foo. Bar. fit (1 , 2 ))
387- @test body == " Foo.Bar.fit(a, b) = a + b"
402+ if Base. VERSION < v " 1.10"
403+ @test body == " Foo.Bar.fit(a, b) = a + b"
404+ end
388405end
389406
390407struct CallOverload
@@ -403,10 +420,10 @@ end
403420
404421@testset " kwfuncs" begin
405422 body, _ = CodeTracking. definition (String, @which fkw (; x= 1 ))
406- @test body == """
423+ @test startswith ( body, """
407424 function fkw(; x=1)
408425 x
409- end"""
426+ end""" )
410427end
411428
412429@testset " Decorated args" begin
@@ -425,12 +442,12 @@ end
425442 body, _ = CodeTracking. definition (String, which (hasdefault, (Int, Float32)))
426443 @test body == " hasdefault(xd, yd=2) = xd + yd"
427444 body, _ = CodeTracking. definition (String, which (hasdefaulttypearg, (Type{Float32},)))
428- @test body == " hasdefaulttypearg(::Type{T}=Rational{Int}) where T = zero(T)"
445+ @test startswith ( body, " hasdefaulttypearg(::Type{T}=Rational{Int}) where T = zero(T)" )
429446end
430447
431448@testset " tuple-destructured args" begin
432449 body, _ = CodeTracking. definition (String, which (diffminmax, (Any,)))
433- @test body == " diffminmax((min, max)) = max - min"
450+ @test startswith ( body, " diffminmax((min, max)) = max - min" )
434451end
435452
436453@testset " strip_gensym with unicode" begin
0 commit comments