From 741b5dacab3a1e29517535e28a535e506faa3ab5 Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:28:39 +0900 Subject: [PATCH] forward-port #53096 to nightly, fix the intermittent REPL test failure (#53097) While the original issue #52739 has been observed only in v1.10, the necessity to enhance the robustness of the corresponding test code is still applicable in the nightly. See #53096 for the details. --- stdlib/REPL/test/replcompletions.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/REPL/test/replcompletions.jl b/stdlib/REPL/test/replcompletions.jl index 280b23a68c4e2..ac4f34b7b9180 100644 --- a/stdlib/REPL/test/replcompletions.jl +++ b/stdlib/REPL/test/replcompletions.jl @@ -648,7 +648,7 @@ let s = "CompletionFoo.?([1,2,3], 2.0)" c, r, res = test_complete(s) @test !res @test length(c) == 1 - @test occursin("test(x::AbstractArray{T}, y) where T<:Real", c[1]) + @test occursin("test(x::AbstractArray{T}, y) where T<:Real", only(c)) # In particular, this checks that test(args...) is not a valid completion # since it is strictly less specific than test(x::AbstractArray{T}, y) end @@ -682,15 +682,15 @@ let s = "CompletionFoo.?(false, \"a\", 3, " c, r, res = test_complete(s) @test !res @test length(c) == 2 - @test occursin("test(args...)", c[1]) - @test occursin("test11(a::Integer, b, c)", c[2]) + @test any(s->occursin("test(args...)", s), c) + @test any(s->occursin("test11(a::Integer, b, c)", s), c) end let s = "CompletionFoo.?(false, \"a\", 3, " c, r, res = test_complete_noshift(s) @test !res @test length(c) == 1 - @test occursin("test11(a::Integer, b, c)", c[1]) + @test occursin("test11(a::Integer, b, c)", only(c)) end let s = "CompletionFoo.?(\"a\", 3, " @@ -713,7 +713,7 @@ let s = "CompletionFoo.?()" c, r, res = test_complete_noshift(s) @test !res @test length(c) == 1 - @test occursin("test10(s::String...)", c[1]) + @test occursin("test10(s::String...)", only(c)) end #= TODO: restrict the number of completions when a semicolon is present in ".?(" syntax @@ -731,7 +731,7 @@ let s = "CompletionFoo.?(3; len2=5, " c, r, res = test_complete_noshift(s) @test !res @test length(c) == 1 - @test occursin("kwtest3(a::Integer; namedarg, foobar, slurp...)", c[1]) + @test occursin("kwtest3(a::Integer; namedarg, foobar, slurp...)", only(c)) # the other two kwtest3 methods should not appear because of specificity end =#