OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 7964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7975 } | 7975 } |
7976 | 7976 |
7977 | 7977 |
7978 TEST(MiscSyntaxErrors) { | 7978 TEST(MiscSyntaxErrors) { |
7979 const char* context_data[][2] = { | 7979 const char* context_data[][2] = { |
7980 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; | 7980 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; |
7981 const char* error_data[] = {"for (();;) {}", NULL}; | 7981 const char* error_data[] = {"for (();;) {}", NULL}; |
7982 | 7982 |
7983 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); | 7983 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); |
7984 } | 7984 } |
| 7985 |
| 7986 TEST(PatternSyntaxError) { |
| 7987 v8::V8::Initialize(); |
| 7988 v8::HandleScope scope(CcTest::isolate()); |
| 7989 v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate())); |
| 7990 |
| 7991 const char* sources[] = { |
| 7992 // crbug.com/582626 |
| 7993 "{ NaN ,chA((evarA=new t ( l = !.0[((... co -a0([1]))=> greturnkf", |
| 7994 |
| 7995 // Simplified case: |
| 7996 "(...rest - a) => b", |
| 7997 }; |
| 7998 |
| 7999 for (int i = 0; i < arraysize(sources); i++) { |
| 8000 v8::TryCatch try_catch(CcTest::isolate()); |
| 8001 v8_compile(v8_str(sources[i])); |
| 8002 CHECK(try_catch.HasCaught()); |
| 8003 v8::String::Utf8Value exception(try_catch.Exception()); |
| 8004 CHECK_EQ(0, strcmp("SyntaxError: Not supported", *exception)); |
| 8005 } |
| 8006 } |
OLD | NEW |