diff --git a/lib/pp.rb b/lib/pp.rb index 1708dee..4fdeb33 100644 --- a/lib/pp.rb +++ b/lib/pp.rb @@ -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 '' diff --git a/test/test_pp.rb b/test/test_pp.rb index bb2299a..3e1c725 100644 --- a/test/test_pp.rb +++ b/test/test_pp.rb @@ -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)) + end end class HasInspect