fixed bug when heredoc starts by \; removing \n from a heredoc value end

This commit is contained in:
z7zmey
2018-07-14 18:00:48 +03:00
parent 4da7b36056
commit 867095823d
11 changed files with 848 additions and 791 deletions

View File

@@ -665,6 +665,7 @@ func (p *Printer) printScalarHeredoc(n node.Node) {
}
}
io.WriteString(p.w, "\n")
io.WriteString(p.w, strings.Trim(nn.Label, "\"'"))
p.printMeta(nn, meta.NodeEnd)

View File

@@ -575,7 +575,7 @@ func TestPrinterPrintScalarHeredoc(t *testing.T) {
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "hello "},
&expr.Variable{VarName: &node.Identifier{Value: "var"}},
&scalar.EncapsedStringPart{Value: " world\n"},
&scalar.EncapsedStringPart{Value: " world"},
},
})
@@ -602,7 +602,7 @@ func TestPrinterPrintScalarNowdoc(t *testing.T) {
},
Label: "'LBL'",
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "hello world\n"},
&scalar.EncapsedStringPart{Value: "hello world"},
},
})