Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def pretty_print_cycle(q) # :nodoc:

class Range # :nodoc:
def pretty_print(q) # :nodoc:
q.pp self.begin
q.pp self.begin if self.begin
q.breakable ''
q.text(self.exclude_end? ? '...' : '..')
q.breakable ''
Expand Down
7 changes: 7 additions & 0 deletions test/test_pp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def o.method
end
assert_equal(%(""\n), PP.pp(o, "".dup))
end

def test_range
assert_equal("0..1\n", PP.pp(0..1, "".dup))
assert_equal("0...1\n", PP.pp(0...1, "".dup))
assert_equal("0...\n", PP.pp(0..., "".dup))
assert_equal("...1\n", PP.pp(...1, "".dup))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be wroth to test a beginless endless range too

end
end

class HasInspect
Expand Down