ruby-changes:44187
From: headius <ko1@a...>
Date: Tue, 27 Sep 2016 06:12:16 +0900 (JST)
Subject: [ruby-changes:44187] headius:r56260 (trunk): * test/ripper/test_ripper.rb: add a test for dedent_string.
headius 2016-09-27 06:12:12 +0900 (Tue, 27 Sep 2016) New Revision: 56260 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56260 Log: * test/ripper/test_ripper.rb: add a test for dedent_string. Modified files: trunk/test/ripper/test_ripper.rb Index: test/ripper/test_ripper.rb =================================================================== --- test/ripper/test_ripper.rb (revision 56259) +++ test/ripper/test_ripper.rb (revision 56260) @@ -98,4 +98,23 @@ class TestRipper::Ripper < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ripper/test_ripper.rb#L98 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/