scanner: handle carriage return in comments (#656)

Fixes #653
This commit is contained in:
Thomas Pelletier
2021-11-04 21:40:16 -04:00
committed by GitHub
parent 6617e7e73d
commit 74d21b367f
2 changed files with 26 additions and 0 deletions
+20
View File
@@ -1557,6 +1557,18 @@ B = "data"`,
}
},
},
{
desc: "comment with CRLF",
input: "# foo\r\na=2",
gen: func() test {
doc := map[string]interface{}{}
return test{
target: &doc,
expected: &map[string]interface{}{"a": int64(2)},
}
},
},
}
for _, e := range examples {
@@ -2219,6 +2231,14 @@ world'`,
desc: `carriage return inside basic string`,
data: "A = \"\r\"",
},
{
desc: `carriage return in comment`,
data: "# this is a test\ra=1",
},
{
desc: `backspace in comment`,
data: "# this is a test\ba=1",
},
}
for _, e := range examples {