Commit effb7ad7 authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[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: 's avatarCaitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#58976}
parent 0781f42b
......@@ -11400,7 +11400,12 @@ TEST(PrivateNamesSyntaxError) {
TEST(HashbangSyntax) {
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};
......@@ -11440,11 +11445,18 @@ TEST(HashbangSyntaxErrors) {
const char* invalid_hashbang_data[] = {// Encoded characters are not allowed
"#\\u0021\n"
"#\\u{21}\n",
"#\\x21\n",
"#\\041\n",
"\\u0023!\n",
"\\u{23}!\n",
"\\x23!\n",
"\\043!\n",
"\\u0023\\u0021\n",
"\n#!---IGNORED---\n",
" #!---IGNORED---\n", nullptr};
" #!---IGNORED---\n",
nullptr};
const char* hashbang_data[] = {"#!\n", "#!---IGNORED---\n", nullptr};
auto SyntaxErrorTest = [](const char* context_data[][2], const char* data[]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment