diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2014-03-18 00:33:01 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2014-03-18 00:33:01 +0400 |
commit | 4d140746f0978da2a6493b92d3b6de4b18f3394d (patch) | |
tree | 69d76bb397ca1dde203a5d7535ecc33c58c85f25 /deps/v8/test/cctest/test-parsing.cc | |
parent | ee4b9b552dee37ed5844da6c261e4d28a33d3c13 (diff) | |
download | node-new-4d140746f0978da2a6493b92d3b6de4b18f3394d.tar.gz |
deps: update v8 to 3.24.35.17
Diffstat (limited to 'deps/v8/test/cctest/test-parsing.cc')
-rw-r--r-- | deps/v8/test/cctest/test-parsing.cc | 114 |
1 files changed, 3 insertions, 111 deletions
diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 30e97aabdc..22d5056f80 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -1108,9 +1108,8 @@ enum ParserSyncTestResult { kError }; -template <typename Traits> -void SetParserFlags(i::ParserBase<Traits>* parser, - i::EnumSet<ParserFlag> flags) { + +void SetParserFlags(i::ParserBase* 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)); @@ -1391,7 +1390,7 @@ void RunParserSyncTest(const char* context_data[][2], static const ParserFlag flags[] = { kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators, - kAllowForOf, kAllowNativesSyntax + kAllowForOf }; for (int i = 0; context_data[i][0] != NULL; ++i) { for (int j = 0; statement_data[j] != NULL; ++j) { @@ -2014,110 +2013,3 @@ 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); -} - - -TEST(Intrinsics) { - const char* context_data[][2] = { - {"", ""}, - { NULL, NULL } - }; - - const char* statement_data[] = { - "%someintrinsic(arg)", - NULL - }; - - // Parsing will fail or succeed depending on whether we allow natives syntax - // or not. - RunParserSyncTest(context_data, statement_data, kSuccessOrError); -} - - -TEST(NoErrorsNewExpression) { - const char* context_data[][2] = { - {"", ""}, - {"var f =", ""}, - { NULL, NULL } - }; - - const char* statement_data[] = { - "new foo", - "new foo();", - "new foo(1);", - "new foo(1, 2);", - // The first () will be processed as a part of the NewExpression and the - // second () will be processed as part of LeftHandSideExpression. - "new foo()();", - // The first () will be processed as a part of the inner NewExpression and - // the second () will be processed as a part of the outer NewExpression. - "new new foo()();", - "new foo.bar;", - "new foo.bar();", - "new foo.bar.baz;", - "new foo.bar().baz;", - "new foo[bar];", - "new foo[bar]();", - "new foo[bar][baz];", - "new foo[bar]()[baz];", - "new foo[bar].baz(baz)()[bar].baz;", - "new \"foo\"", // Runtime error - "new 1", // Runtime error - "new foo++", - // This even runs: - "(new new Function(\"this.x = 1\")).x;", - "new new Test_Two(String, 2).v(0123).length;", - NULL - }; - - RunParserSyncTest(context_data, statement_data, kSuccess); -} - - -TEST(ErrorsNewExpression) { - const char* context_data[][2] = { - {"", ""}, - {"var f =", ""}, - { NULL, NULL } - }; - - const char* statement_data[] = { - "new foo bar", - "new ) foo", - "new ++foo", - NULL - }; - - RunParserSyncTest(context_data, statement_data, kError); -} |