* 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
This commit is contained in:
headius 2016-09-26 21:12:12 +00:00
parent c2e59df31b
commit fbaa823344
1 changed files with 19 additions and 0 deletions

View File

@ -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