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 14, 2024
1 parent 7c6d016 commit 2659cff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/scopedvalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ 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 startswith(sprint(show, Core.current_scope()), "Base.ScopedValues.Scope(")
@test contains(sprint(show, Core.current_scope()), "Base.ScopedValues.ScopedValue{$Int}@$objid => 2")
end
end

Expand Down

0 comments on commit 2659cff

Please sign in to comment.