Skip to content

Commit 06a694d

Browse files
tkfomus
andauthored
Fix show(::IO, ::BenchmarkResults); don't print directly to stdout (#118)
Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>
1 parent 8f37be0 commit 06a694d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/benchmarkresults.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Base.show(io::IO, results::BenchmarkResults)
4242
ioc = IOContext(iob)
4343
show(ioc, MIME("text/plain"), results.benchmarkgroup)
4444
println(io, " BenchmarkGroup:")
45-
print(join(" " .* split(String(take!(iob)), "\n"), "\n"))
45+
print(io, join(" " .* split(String(take!(iob)), "\n"), "\n"))
4646
end
4747

4848
"""

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ end
5656
@test PkgBenchmark.name(results) == "PkgBenchmark"
5757
@test Dates.Year(PkgBenchmark.date(results)) == Dates.Year(now())
5858
export_markdown(stdout, results)
59+
str = sprint(show, "text/plain", results)
60+
@test occursin(r"\d-element .*\.BenchmarkGroup", str)
5961
end
6062

6163
@testset "objectpath/loadobject" begin

0 commit comments

Comments
 (0)