Bug #19485
closedUnexpected behavior in squiggly heredocs
Description
Based on the squiggly heredoc documentation, I found the following to be unexpected behavior. Explicitly, the documentation specifies, "The indentation of the least-indented line will be removed from each line of the content."
After running:
and then ruby test.rb, I get the following output:
The least-indented line above is b, however, no leading whitespace is removed from the line containing \ta.
For another example:
ruby test.rb gives:
In this case, the \t was removed from the line containing A, but more whitespace than that ( \t) was removed from the line containing B.
After seeing the first example, I assumed that the documentation was out of date, and that I should fix it to read that \t would never be converted into space characters in order to remove leading whitespace. But after the second example, it seems like this is a bug in removing leading whitespace.
Can someone please explain what the rules should be on squiggly heredocs? I can implement a fix to adhere to the rules, or can update the documentation, I am just unsure of what the rules should be because the above two examples reflect unexpected behavior in two distinct ways.