Skip to content

Commit 46a7504

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

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/scopedvalues.jl

+7-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ 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 startswith(sprint(show, Core.current_scope()), "Base.ScopedValues.Scope(")
94+
@test contains(sprint(show, Core.current_scope()), "Base.ScopedValues.ScopedValue{$Int}@$objid => 2")
9095
end
9196
end
9297

0 commit comments

Comments
 (0)