summaryrefslogtreecommitdiff
path: root/test/ripper/test_ripper.rb
diff options
context:
space:
mode:
authorheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-26 21:12:12 +0000
committerheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-26 21:12:12 +0000
commitfbaa823344c9ced2991d35fa9bedc3b5844052c5 (patch)
tree46cd159ca8f344f84b2954e522637d7862809c28 /test/ripper/test_ripper.rb
parentc2e59df31b333f5c91c62c68fb391fdac83970b5 (diff)
* test/ripper/test_ripper.rb: add a test for dedent_string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_ripper.rb')
-rw-r--r--test/ripper/test_ripper.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb
index afe7183..cbd025d 100644
--- a/test/ripper/test_ripper.rb
+++ b/test/ripper/test_ripper.rb
@@ -98,4 +98,23 @@ class TestRipper::Ripper < Test::Unit::TestCase
assert_nil(Ripper.sexp(src), bug12651)
end;
end
+
+ # https://bugs.jruby.org/4176
+ def test_dedent_string
+ col = Ripper.dedent_string ' hello', 0
+ assert_equal 0, col
+ col = Ripper.dedent_string ' hello', 2
+ assert_equal 2, col
+ col = Ripper.dedent_string ' hello', 4
+ assert_equal 2, col
+
+ # lexing a squiggly heredoc triggers Ripper#dedent_string use
+ src = <<-END
+puts <<~END
+ hello
+end
+ END
+
+ assert_nothing_raised { Ripper.lex src }
+ end
end if ripper_test