From 9a28a29b870b5f45d370bc8f16c431b435f0bbb3 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 7 Dec 2015 14:39:52 +0000 Subject: parse.y: indented hereoc * parse.y: add heredoc <<~ syntax. [Feature #9098] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ripper/test_parser_events.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ripper/test_parser_events.rb') diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 55485b68d0..540d36e4d9 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -431,6 +431,19 @@ class TestRipper::ParserEvents < Test::Unit::TestCase assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921) end + def test_heredoc_dedent + thru_heredoc_dedent = false + str = width = nil + tree = parse("<""<~EOS\n heredoc\nEOS\n", :on_heredoc_dedent) {|e, s, w| + thru_heredoc_dedent = true + str = s + width = w + } + assert_equal true, thru_heredoc_dedent + assert_match(/string_content\(\), heredoc\n/, tree) + assert_equal(1, width) + end + def test_massign thru_massign = false parse("a, b = 1, 2", :on_massign) {thru_massign = true} -- cgit v1.2.3