Chromium Code Reviews| Index: test/cctest/test-parsing.cc |
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
| index 287b61b02c27b9fbbc206fff4b74f5d6b2dce74a..59ee11896f3334f1ece84a62b6558bf1a9247a52 100644 |
| --- a/test/cctest/test-parsing.cc |
| +++ b/test/cctest/test-parsing.cc |
| @@ -9449,3 +9449,24 @@ TEST(NoPessimisticContextAllocation) { |
| } |
| } |
| } |
| + |
| +TEST(EscapedStrictReservedWord) { |
| + // Test that identifiers which are both escaped and only reserved in the |
| + // strict mode are accepted in non-strict mode. |
| + v8::V8::Initialize(); |
| + v8::HandleScope scope(CcTest::isolate()); |
| + v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate())); |
| + const char* scripts[] = { |
| + "if (true) l\u0065t: ;", "function l\u0065t() { }", |
| + "(function l\u0065t() { })", "async function l\u0065t() { }", |
| + "(async function l\u0065t() { })", "async l\u0065t => 42"}; |
| + for (const char* script : scripts) { |
| + v8::TryCatch try_catch(CcTest::isolate()); |
| + v8_compile(script); |
|
vabr (Chromium)
2017/02/14 23:58:53
I'm not at all sure that I'm doing the right thing
|
| + if (try_catch.HasCaught()) { |
| + v8::String::Utf8Value exception(try_catch.Exception()); |
| + v8::base::OS::Print("Compiling %s failed with %s.", script, *exception); |
| + CHECK(false); |
| + } |
| + } |
| +} |