| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index 22d5056f8007c4afa1ae0f95cc813d3f22133e6c..3d8fc39fcc2d26c828ecc393217c73d1ca33a4eb 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -1108,8 +1108,9 @@ enum ParserSyncTestResult {
|
| kError
|
| };
|
|
|
| -
|
| -void SetParserFlags(i::ParserBase* parser, i::EnumSet<ParserFlag> flags) {
|
| +template <typename Traits>
|
| +void SetParserFlags(i::ParserBase<Traits>* parser,
|
| + i::EnumSet<ParserFlag> flags) {
|
| parser->set_allow_lazy(flags.Contains(kAllowLazy));
|
| parser->set_allow_natives_syntax(flags.Contains(kAllowNativesSyntax));
|
| parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping));
|
| @@ -2013,3 +2014,35 @@ TEST(NoErrorsTryCatchFinally) {
|
|
|
| RunParserSyncTest(context_data, statement_data, kSuccess);
|
| }
|
| +
|
| +
|
| +TEST(ErrorsRegexpLiteral) {
|
| + const char* context_data[][2] = {
|
| + {"var r = ", ""},
|
| + { NULL, NULL }
|
| + };
|
| +
|
| + const char* statement_data[] = {
|
| + "/unterminated",
|
| + NULL
|
| + };
|
| +
|
| + RunParserSyncTest(context_data, statement_data, kError);
|
| +}
|
| +
|
| +
|
| +TEST(NoErrorsRegexpLiteral) {
|
| + const char* context_data[][2] = {
|
| + {"var r = ", ""},
|
| + { NULL, NULL }
|
| + };
|
| +
|
| + const char* statement_data[] = {
|
| + "/foo/",
|
| + "/foo/g",
|
| + "/foo/whatever", // This is an error but not detected by the parser.
|
| + NULL
|
| + };
|
| +
|
| + RunParserSyncTest(context_data, statement_data, kSuccess);
|
| +}
|
|
|