Add profile summary to TAP output

This commit is contained in:
Michael Miller 2019-03-25 16:49:57 -06:00
parent 291a927f1e
commit df6431f2d7

View file

@ -35,7 +35,24 @@ module Spectator::Formatting
# Displays profiling information.
private def profile(profile)
raise NotImplementedError.new("profile")
@io.puts(Comment.new(ProfileSummary.new(profile)))
indent = Indent.new(@io)
indent.increase do
profile.each do |result|
profile_entry(indent, result)
end
end
end
# Adds a profile result entry to the output.
private def profile_entry(indent, result)
@io << "# "
indent.line(result.example)
indent.increase do
@io << "# "
indent.line(SourceTiming.new(result.elapsed, result.example.source))
end
end
end
end