[Bug #20474] Keep spaces in leading blank line
This commit is contained in:
parent
841b45a442
commit
5bb656e4f0
4
parse.y
4
parse.y
@ -8578,6 +8578,10 @@ parser_update_heredoc_indent(struct parser_params *p, int c)
|
|||||||
}
|
}
|
||||||
p->heredoc_line_indent = -1;
|
p->heredoc_line_indent = -1;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* Whitespace only line has no indentation */
|
||||||
|
p->heredoc_line_indent = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -889,6 +889,16 @@ e"
|
|||||||
assert_dedented_heredoc(expect, result)
|
assert_dedented_heredoc(expect, result)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_dedented_heredoc_with_leading_blank_line
|
||||||
|
# the blank line has six leading spaces
|
||||||
|
result = " \n" \
|
||||||
|
" b\n"
|
||||||
|
expect = " \n" \
|
||||||
|
"b\n"
|
||||||
|
assert_dedented_heredoc(expect, result)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_dedented_heredoc_with_blank_more_indented_line_escaped
|
def test_dedented_heredoc_with_blank_more_indented_line_escaped
|
||||||
result = " a\n" \
|
result = " a\n" \
|
||||||
"\\ \\ \\ \\ \\ \\ \n" \
|
"\\ \\ \\ \\ \\ \\ \n" \
|
||||||
@ -996,7 +1006,7 @@ eom
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_dedented_heredoc_concatenation
|
def test_dedented_heredoc_concatenation
|
||||||
assert_equal("\n0\n1", eval("<<~0 '1'\n \n0\#{}\n0"))
|
assert_equal(" \n0\n1", eval("<<~0 '1'\n \n0\#{}\n0"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_heredoc_mixed_encoding
|
def test_heredoc_mixed_encoding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user