summaryrefslogtreecommitdiff
path: root/test/ripper/test_parser_events.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-07 14:39:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-07 14:39:52 +0000
commit9a28a29b870b5f45d370bc8f16c431b435f0bbb3 (patch)
tree1a8a83e8ca857731116ed37273b53d6812afd011 /test/ripper/test_parser_events.rb
parent9f51e95fc18002939505ce352dee3f97efde3ada (diff)
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
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r--test/ripper/test_parser_events.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 55485b6..540d36e 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}