Skip to content

Commit

Permalink
fix scopedvalues tests that assume no scope
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Oct 6, 2024
1 parent d773b4a commit e1e7763
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/scopedvalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ end
@testset "show" begin
@test sprint(show, ScopedValue{Int}()) == "Base.ScopedValues.ScopedValue{$Int}(undefined)"
@test sprint(show, sval) == "Base.ScopedValues.ScopedValue{$Int}(1)"
@test sprint(show, Core.current_scope()) == "nothing"
if Core.current_scope() === nothing
# Base.runtests uses @timed which introduces a scope for scheduler timing
@test sprint(show, Core.current_scope()) == "nothing"
end
with(sval => 2.0) do
@test sprint(show, sval) == "Base.ScopedValues.ScopedValue{$Int}(2)"
objid = sprint(show, Base.objectid(sval))
@test sprint(show, Core.current_scope()) == "Base.ScopedValues.Scope(Base.ScopedValues.ScopedValue{$Int}@$objid => 2)"
# Base.runtests uses @timed which introduces a scope for scheduler timing
@test contains(sprint(show, Core.current_scope()), "Base.ScopedValues.Scope(Base.ScopedValues.ScopedValue{$Int}@$objid => 2")
end
end

Expand Down

0 comments on commit e1e7763

Please sign in to comment.