Skip to content

Commit 2c8ecd3

Browse files
authored
1.10: REPL: fix intermittent REPL test failure (#53096)
The earlier test relied on the order of the method match list returned by `_methods_by_ftype`. However, particularly in cases where the `ambig=true` option is used, the match list isn't deterministic. This commit modifies it, similar to other pieces of code, so that it `any` to ensure the code does not depend on the implementation details of `ml_matches`. Fixes #52739.
1 parent ece8b7b commit 2c8ecd3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

stdlib/REPL/test/replcompletions.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ let s = "CompletionFoo.?([1,2,3], 2.0)"
646646
c, r, res = test_complete(s)
647647
@test !res
648648
@test length(c) == 1
649-
@test occursin("test(x::AbstractArray{T}, y) where T<:Real", c[1])
649+
@test occursin("test(x::AbstractArray{T}, y) where T<:Real", only(c))
650650
# In particular, this checks that test(args...) is not a valid completion
651651
# since it is strictly less specific than test(x::AbstractArray{T}, y)
652652
end
@@ -680,15 +680,15 @@ let s = "CompletionFoo.?(false, \"a\", 3, "
680680
c, r, res = test_complete(s)
681681
@test !res
682682
@test length(c) == 2
683-
@test occursin("test(args...)", c[1])
684-
@test occursin("test11(a::Integer, b, c)", c[2])
683+
@test any(s->occursin("test(args...)", s), c)
684+
@test any(s->occursin("test11(a::Integer, b, c)", s), c)
685685
end
686686

687687
let s = "CompletionFoo.?(false, \"a\", 3, "
688688
c, r, res = test_complete_noshift(s)
689689
@test !res
690690
@test length(c) == 1
691-
@test occursin("test11(a::Integer, b, c)", c[1])
691+
@test occursin("test11(a::Integer, b, c)", only(c))
692692
end
693693

694694
let s = "CompletionFoo.?(\"a\", 3, "
@@ -711,7 +711,7 @@ let s = "CompletionFoo.?()"
711711
c, r, res = test_complete_noshift(s)
712712
@test !res
713713
@test length(c) == 1
714-
@test occursin("test10(s::String...)", c[1])
714+
@test occursin("test10(s::String...)", only(c))
715715
end
716716

717717
#= TODO: restrict the number of completions when a semicolon is present in ".?(" syntax

0 commit comments

Comments
 (0)