Skip to content

Commit df0bb5e

Browse files
committed
test test_roundtrip_write w/o temp files
1 parent 6bad5d3 commit df0bb5e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/testtools.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ function test_roundtrip_write(encoder, decoder)
1616
srand(12345)
1717
for n in vcat(0:30, sort!(rand(500:100_000, 30))), alpha in (0x00:0xff, 0x00:0x0f)
1818
data = rand(alpha, n)
19-
mktemp() do path, file
20-
stream = encoder(decoder(file))
21-
write(stream, data)
22-
close(stream)
23-
Base.Test.@test hash(read(path)) == hash(data)
24-
end
19+
file = IOBuffer()
20+
stream = encoder(decoder(file))
21+
write(stream, data, TOKEN_END); flush(stream)
22+
Base.Test.@test hash(take!(file)) == hash(data)
23+
close(stream)
2524
end
2625
end

0 commit comments

Comments
 (0)