diff options
author | headius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-26 21:12:12 +0000 |
---|---|---|
committer | headius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-26 21:12:12 +0000 |
commit | fbaa823344c9ced2991d35fa9bedc3b5844052c5 (patch) | |
tree | 46cd159ca8f344f84b2954e522637d7862809c28 /test | |
parent | c2e59df31b333f5c91c62c68fb391fdac83970b5 (diff) | |
download | ruby-fbaa823344c9ced2991d35fa9bedc3b5844052c5.tar.gz |
* 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')
-rw-r--r-- | test/ripper/test_ripper.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb index afe7183ff4..cbd025d2ad 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 |