aboutsummaryrefslogtreecommitdiff
path: root/syntax/scan_test.go
diff options
context:
space:
mode:
authoralandonovan <adonovan@google.com>2020-06-15 13:21:36 -0400
committerGitHub <noreply@github.com>2020-06-15 13:21:36 -0400
commit2319aeb99686f39c8515e43eb9192e0eedf60343 (patch)
treebb9cead9cd1b06e6bbe14f6dc6563b0c4dba326f /syntax/scan_test.go
parentac23acb182e187e6835e4c0cc42205fe37a05624 (diff)
downloadstarlark-go-2319aeb99686f39c8515e43eb9192e0eedf60343.tar.gz
syntax: permit \" and \' escapes in both "..." and '...' literals (#279)
Clarify spec on this issue. Fixes https://github.com/google/starlark-go/issues/278 Also, fix semantic merge conflict in testdata/json.star tests that relied on "\u" being interpreted as "\\u", causing tests to fail.
Diffstat (limited to 'syntax/scan_test.go')
-rw-r--r--syntax/scan_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/syntax/scan_test.go b/syntax/scan_test.go
index fecf26f..0f2d9f2 100644
--- a/syntax/scan_test.go
+++ b/syntax/scan_test.go
@@ -200,16 +200,16 @@ pass`, "pass newline pass EOF"}, // consecutive newlines are consolidated
{`"\+"`, `foo.star:1:1: invalid escape sequence \+`},
{`"\w"`, `foo.star:1:1: invalid escape sequence \w`},
{`"\""`, `"\"" EOF`},
- {`"\'"`, `foo.star:1:1: invalid escape sequence \'`},
+ {`"\'"`, `"'" EOF`},
{`'\w'`, `foo.star:1:1: invalid escape sequence \w`},
{`'\''`, `"'" EOF`},
- {`'\"'`, `foo.star:1:1: invalid escape sequence \"`},
+ {`'\"'`, `"\"" EOF`},
{`"""\w"""`, `foo.star:1:1: invalid escape sequence \w`},
{`"""\""""`, `"\"" EOF`},
- {`"""\'"""`, `foo.star:1:1: invalid escape sequence \'`},
+ {`"""\'"""`, `"'" EOF`},
{`'''\w'''`, `foo.star:1:1: invalid escape sequence \w`},
{`'''\''''`, `"'" EOF`},
- {`'''\"'''`, `foo.star:1:1: invalid escape sequence \"`}, // error
+ {`'''\"'''`, `"\"" EOF`},
{`r"\w"`, `"\\w" EOF`},
{`r"\""`, `"\\\"" EOF`},
{`r"\'"`, `"\\'" EOF`},