diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-03 02:51:00 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-03 02:51:00 +0000 |
commit | 737d15391a08d1bcac3b03de76375deac99df090 (patch) | |
tree | fc1cce603b460ce0225c413a9594e2cbf6222ecc /test | |
parent | 65992061b918c397cfff6214bec556d7e83b835d (diff) |
merge revision(s) 60213: [Backport #14032]
parse.y: indent at '#'
* parse.y (parser_here_document): update indent at '#', which is
not a space. [ruby-core:83368] [Bug #14032]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ripper/test_lexer.rb | 20 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb index 72b7f1b5fd..03b64cce8f 100644 --- a/test/ripper/test_lexer.rb +++ b/test/ripper/test_lexer.rb @@ -32,4 +32,24 @@ class TestRipper::Lexer < Test::Unit::TestCase E assert_equal(str, Ripper.tokenize(str).join(""), bug) end + + def test_expr_at_beginning_in_heredoc + src = <<~'E' + <<~B + a + #{1} + B + E + expect = %I[ + on_heredoc_beg + on_nl + on_tstring_content + on_embexpr_beg + on_int + on_embexpr_end + on_tstring_content + on_heredoc_end + ] + assert_equal expect, Ripper.lex(src).map {|e| e[1]} + end end diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 749574f625..f9e27be33e 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -659,6 +659,14 @@ e" end end + def test_dedented_heredoc_expr_at_beginning + result = " a\n" \ + '#{1}'"\n" + expected = " a\n" \ + '#{1}'"\n" + assert_dedented_heredoc(expected, result) + end + def test_lineno_after_heredoc bug7559 = '[ruby-dev:46737]' expected, _, actual = __LINE__, <<eom, __LINE__ |