29 lines
680 B
Crystal
29 lines
680 B
Crystal
module Spectator::Formatting
|
|
# Contents of a profile block.
|
|
private struct ProfileBlock
|
|
# Creates the block.
|
|
def initialize(@profile : Profile)
|
|
end
|
|
|
|
# Appends the block to the output.
|
|
def to_s(io)
|
|
io.puts(ProfileSummary.new(@profile))
|
|
|
|
indent = Indent.new(io)
|
|
indent.increase do
|
|
@profile.each do |(example, result)|
|
|
entry(indent, example, result)
|
|
end
|
|
end
|
|
end
|
|
|
|
# Adds a result entry to the output.
|
|
private def entry(indent, example, result)
|
|
indent.line(example)
|
|
indent.increase do
|
|
indent.line(LocationTiming.new(result.elapsed, example.location))
|
|
end
|
|
end
|
|
end
|
|
end
|