Skip to content

Commit

Permalink
Use sprint() instead of global IO buffers in test_display
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Jan 20, 2025
1 parent ba8e1f7 commit 7754124
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/test_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ using Test, GeoFormatTypes, Extents
import GeoInterface as GI
using GeoInterface.Wrappers

# use this to test our string representations for geoms
buf = IOBuffer()
compact_buf = IOContext(buf, :compact => true)

# checks that our string display for geoms in regular/compact form is as expected
function test_display(geom, expected_str, expected_compact_str)
# checks non-compact string repr
show(buf, MIME"text/plain"(), geom)
@test expected_str == String(take!(buf))
generated_str = sprint() do io
show(io, MIME"text/plain"(), geom)
end
@test expected_str == generated_str
# checks compact string repr
show(compact_buf, MIME"text/plain"(), geom)
@test expected_compact_str == String(take!(buf))
generated_compact_str = sprint() do io
show(IOContext(io, :compact => true), MIME"text/plain"(), geom)
end
@test expected_compact_str == generated_compact_str
end

# Point
Expand Down

0 comments on commit 7754124

Please sign in to comment.