Skip to content

Commit

Permalink
Add location to skipped examples
Browse files Browse the repository at this point in the history
Reuse location output code.
Replace location # with @
  • Loading branch information
icy-arctic-fox committed Aug 26, 2024
1 parent ff0f8e5 commit b109219
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/spectator/formatters/common_text_output.cr
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ module Spectator::Formatters
printer.puts error.message
end
printer.puts
if location = error.location
relative_path = location.relative_to(Spectator.working_path)
printer.with_style(:info, &.print "# ", relative_path)
printer.puts
printer.puts
end
printer.puts if print_location(error)
else
print_trace(error)
end
Expand Down Expand Up @@ -121,12 +116,23 @@ module Spectator::Formatters
results.each do |result|
printer.with_style(:warning, &.puts result.example.full_description)
next unless skip_message = result.error_message
printer.indent { printer.puts skip_message }
printer.indent do
print_location(result.example)
printer.puts skip_message
end
end
end
printer.puts
end

private def print_location(locatable)
if location = locatable.location
printer.with_style(:info, &.print "@ ", location.relative_to(Spectator.working_path))
printer.puts
true
end
end

def report_profile : Nil
end

Expand Down

0 comments on commit b109219

Please sign in to comment.