[esnext] Add more hashbang syntax tests
BUG=v8:8523 Change-Id: Id913493bcf0d43da8f4f7cd33921e24d4d94b901 Reviewed-on: https://chromium-review.googlesource.com/c/1425521 Commit-Queue: Mathias Bynens <mathias@chromium.org> Reviewed-by: Caitlin Potter <caitp@igalia.com> Cr-Commit-Position: refs/heads/master@{#58976}
This commit is contained in:
parent
0781f42b67
commit
effb7ad728
@ -11400,7 +11400,12 @@ TEST(PrivateNamesSyntaxError) {
|
|||||||
|
|
||||||
TEST(HashbangSyntax) {
|
TEST(HashbangSyntax) {
|
||||||
const char* context_data[][2] = {
|
const char* context_data[][2] = {
|
||||||
{"#!\n", ""}, {"#!---IGNORED---\n", ""}, {nullptr, nullptr}};
|
{"#!\n", ""},
|
||||||
|
{"#!---IGNORED---\n", ""},
|
||||||
|
{"#!---IGNORED---\r", ""},
|
||||||
|
{"#!---IGNORED---\xE2\x80\xA8", ""}, // <U+2028>
|
||||||
|
{"#!---IGNORED---\xE2\x80\xA9", ""}, // <U+2029>
|
||||||
|
{nullptr, nullptr}};
|
||||||
|
|
||||||
const char* data[] = {"function\nFN\n(\n)\n {\n}\nFN();", nullptr};
|
const char* data[] = {"function\nFN\n(\n)\n {\n}\nFN();", nullptr};
|
||||||
|
|
||||||
@ -11440,11 +11445,18 @@ TEST(HashbangSyntaxErrors) {
|
|||||||
|
|
||||||
const char* invalid_hashbang_data[] = {// Encoded characters are not allowed
|
const char* invalid_hashbang_data[] = {// Encoded characters are not allowed
|
||||||
"#\\u0021\n"
|
"#\\u0021\n"
|
||||||
|
"#\\u{21}\n",
|
||||||
|
"#\\x21\n",
|
||||||
|
"#\\041\n",
|
||||||
"\\u0023!\n",
|
"\\u0023!\n",
|
||||||
|
"\\u{23}!\n",
|
||||||
|
"\\x23!\n",
|
||||||
|
"\\043!\n",
|
||||||
"\\u0023\\u0021\n",
|
"\\u0023\\u0021\n",
|
||||||
|
|
||||||
"\n#!---IGNORED---\n",
|
"\n#!---IGNORED---\n",
|
||||||
" #!---IGNORED---\n", nullptr};
|
" #!---IGNORED---\n",
|
||||||
|
nullptr};
|
||||||
const char* hashbang_data[] = {"#!\n", "#!---IGNORED---\n", nullptr};
|
const char* hashbang_data[] = {"#!\n", "#!---IGNORED---\n", nullptr};
|
||||||
|
|
||||||
auto SyntaxErrorTest = [](const char* context_data[][2], const char* data[]) {
|
auto SyntaxErrorTest = [](const char* context_data[][2], const char* data[]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user