Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: test/cctest/test-parsing.cc

Issue 1657783002: Gracefully handle syntax errors in Parser::PatternRewriter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unit test. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index bc12153729c622cf8ad031f2ae486a679949368a..5eb675020d6c70e40a73dab2d99817bdc33ea344 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -7982,3 +7982,25 @@ TEST(MiscSyntaxErrors) {
RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0);
}
+
+TEST(PatternSyntaxError) {
+ v8::V8::Initialize();
+ v8::HandleScope scope(CcTest::isolate());
+ v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate()));
+
+ const char* sources[] = {
+ // crbug.com/582626
+ "{ NaN ,chA((evarA=new t ( l = !.0[((... co -a0([1]))=> greturnkf",
+
+ // Simplified case:
+ "(...rest - a) => b",
+ };
+
+ for (int i = 0; i < arraysize(sources); i++) {
+ v8::TryCatch try_catch(CcTest::isolate());
+ v8_compile(v8_str(sources[i]));
+ CHECK(try_catch.HasCaught());
+ v8::String::Utf8Value exception(try_catch.Exception());
+ CHECK_EQ(0, strcmp("SyntaxError: Not supported", *exception));
+ }
+}
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698