Skip to content

Commit a2e76bf

Browse files
fix scopedvalues tests that assume no scope
1 parent 07f2df4 commit a2e76bf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/scopedvalues.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,15 @@ end
8282
@testset "show" begin
8383
@test sprint(show, ScopedValue{Int}()) == "Base.ScopedValues.ScopedValue{$Int}(undefined)"
8484
@test sprint(show, sval) == "Base.ScopedValues.ScopedValue{$Int}(1)"
85-
@test sprint(show, Core.current_scope()) == "nothing"
85+
if Core.current_scope() === nothing
86+
# Base.runtests uses @timed which introduces a scope for scheduler timing
87+
@test sprint(show, Core.current_scope()) == "nothing"
88+
end
8689
with(sval => 2.0) do
8790
@test sprint(show, sval) == "Base.ScopedValues.ScopedValue{$Int}(2)"
8891
objid = sprint(show, Base.objectid(sval))
89-
@test sprint(show, Core.current_scope()) == "Base.ScopedValues.Scope(Base.ScopedValues.ScopedValue{$Int}@$objid => 2)"
92+
# Base.runtests uses @timed which introduces a scope for scheduler timing
93+
@test contains(sprint(show, Core.current_scope()), "Base.ScopedValues.Scope(Base.ScopedValues.ScopedValue{$Int}@$objid => 2")
9094
end
9195
end
9296

0 commit comments

Comments
 (0)