Decoder: flag bad \r in literal multiline strings (#687)

Fixes #685
This commit is contained in:
Thomas Pelletier
2021-11-30 10:44:48 -05:00
committed by GitHub
parent b226db6a29
commit ede6445608
2 changed files with 40 additions and 20 deletions
+10 -2
View File
@@ -571,7 +571,7 @@ func TestUnmarshal(t *testing.T) {
},
{
desc: "multiline basic string with windows newline",
input: "A = \"\"\"\r\nTest\"\"\"",
input: "A = \"\"\"\r\nTe\r\nst\"\"\"",
gen: func() test {
type doc struct {
A string
@@ -579,7 +579,7 @@ func TestUnmarshal(t *testing.T) {
return test{
target: &doc{},
expected: &doc{A: "Test"},
expected: &doc{A: "Te\r\nst"},
}
},
},
@@ -2652,6 +2652,14 @@ world'`,
desc: `carriage return inside literal string`,
data: "A = '\r'",
},
{
desc: `carriage return inside multiline literal string`,
data: "a='''\r'''",
},
{
desc: `carriage return at trail of multiline literal string`,
data: "a='''\r",
},
{
desc: `carriage return in comment`,
data: "# this is a test\ra=1",