Display group names

This commit is contained in:
Michael Miller 2019-03-03 11:05:28 -07:00
parent f338e9b99d
commit 52a6a645b9

View file

@ -15,11 +15,24 @@ module Spectator::Formatting
# Does nothing when an example is started.
def start_example(example)
# TODO: Display group names.
# TODO: Condense similar parents.
current_group = example.group
group_list = [] of NestedExampleGroup
while current_group.is_a?(NestedExampleGroup)
group_list << current_group
current_group = current_group.parent
end
indent = 0
group_list.reverse_each do |group|
indent.times { @io.print ' ' }
@io.puts group.what
indent += 2
end
end
# Produces a single character output based on a result.
def end_example(result)
# TODO: Indent.
@io.puts result.call(Color) { result.example.what }
end
end