mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: should not deent concatenated string
* parse.y (string1): reset heredoc indent fore each string leteral so that concatenated string would not be dedented. [ruby-core:72857] [Bug #11990] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1b19168934
commit
0d75b7f99e
3 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Fri Jan 15 16:12:10 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (string1): reset heredoc indent fore each string leteral
|
||||
so that concatenated string would not be dedented.
|
||||
[ruby-core:72857] [Bug #11990]
|
||||
|
||||
Fri Jan 15 09:25:07 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||
|
||||
* common.mk: test-sample was changed to test-basic.
|
||||
|
|
2
parse.y
2
parse.y
|
@ -3912,7 +3912,6 @@ strings : string
|
|||
else {
|
||||
node = evstr2dstr(node);
|
||||
}
|
||||
heredoc_indent = 0;
|
||||
$$ = node;
|
||||
/*%
|
||||
$$ = $1;
|
||||
|
@ -3935,6 +3934,7 @@ string : tCHAR
|
|||
string1 : tSTRING_BEG string_contents tSTRING_END
|
||||
{
|
||||
heredoc_dedent($2);
|
||||
heredoc_indent = 0;
|
||||
/*%%%*/
|
||||
$$ = $2;
|
||||
/*%
|
||||
|
|
|
@ -580,6 +580,15 @@ e"
|
|||
assert_dedented_heredoc(expect, result)
|
||||
end
|
||||
|
||||
def test_dedented_heredoc_with_concatenation
|
||||
bug11990 = '[ruby-core:72857] [Bug #11990] concatenated string should not be dedented'
|
||||
%w[eos "eos" 'eos'].each do |eos|
|
||||
assert_equal("x\n y",
|
||||
eval("<<~#{eos} ' y'\n x\neos\n"),
|
||||
"#{bug11990} with #{eos}")
|
||||
end
|
||||
end
|
||||
|
||||
def test_lineno_after_heredoc
|
||||
bug7559 = '[ruby-dev:46737]'
|
||||
expected, _, actual = __LINE__, <<eom, __LINE__
|
||||
|
|
Loading…
Reference in a new issue