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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 964063003: Fix test for function declarations syntax error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/es6/block-let-declaration.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 2950
2951 RunParserSyncTest(strong_context_data, bad_statement_data, kError, NULL, 0, 2951 RunParserSyncTest(strong_context_data, bad_statement_data, kError, NULL, 0,
2952 always_flags, arraysize(always_flags)); 2952 always_flags, arraysize(always_flags));
2953 RunParserSyncTest(strict_context_data, bad_statement_data, kError, NULL, 0, 2953 RunParserSyncTest(strict_context_data, bad_statement_data, kError, NULL, 0,
2954 always_flags, arraysize(always_flags)); 2954 always_flags, arraysize(always_flags));
2955 RunParserSyncTest(sloppy_context_data, bad_statement_data, kError, NULL, 0, 2955 RunParserSyncTest(sloppy_context_data, bad_statement_data, kError, NULL, 0,
2956 always_flags, arraysize(always_flags)); 2956 always_flags, arraysize(always_flags));
2957 } 2957 }
2958 2958
2959 2959
2960 TEST(NoErrorsDeclsInCase) {
2961 const char* context_data[][2] = {
2962 {"'use strict'; switch(x) { case 1:", "}"},
2963 {"function foo() {'use strict'; switch(x) { case 1:", "}}"},
2964 {"'use strict'; switch(x) { case 1: case 2:", "}"},
2965 {"function foo() {'use strict'; switch(x) { case 1: case 2:", "}}"},
2966 {"'use strict'; switch(x) { default:", "}"},
2967 {"function foo() {'use strict'; switch(x) { default:", "}}"},
2968 {"'use strict'; switch(x) { case 1: default:", "}"},
2969 {"function foo() {'use strict'; switch(x) { case 1: default:", "}}"},
2970 { nullptr, nullptr }
2971 };
2972
2973 const char* statement_data[] = {
2974 "function f() { }",
2975 "class C { }",
2976 "class C extends Q {}",
2977 "function f() { } class C {}",
2978 "function f() { }; class C {}",
2979 "class C {}; function f() {}",
2980 nullptr
2981 };
2982
2983 static const ParserFlag always_flags[] = {kAllowHarmonyClasses};
2984
2985 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
2986 always_flags, arraysize(always_flags));
2987 }
2988
2989
2960 TEST(InvalidLeftHandSide) { 2990 TEST(InvalidLeftHandSide) {
2961 const char* assignment_context_data[][2] = { 2991 const char* assignment_context_data[][2] = {
2962 {"", " = 1;"}, 2992 {"", " = 1;"},
2963 {"\"use strict\"; ", " = 1;"}, 2993 {"\"use strict\"; ", " = 1;"},
2964 { NULL, NULL } 2994 { NULL, NULL }
2965 }; 2995 };
2966 2996
2967 const char* prefix_context_data[][2] = { 2997 const char* prefix_context_data[][2] = {
2968 {"++", ";"}, 2998 {"++", ";"},
2969 {"\"use strict\"; ++", ";"}, 2999 {"\"use strict\"; ++", ";"},
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after
5557 "(a/*\n*/=> a)(1)", 5587 "(a/*\n*/=> a)(1)",
5558 "((a)\n=> a)(1)", 5588 "((a)\n=> a)(1)",
5559 "((a)/*\n*/=> a)(1)", 5589 "((a)/*\n*/=> a)(1)",
5560 "((a, b)\n=> a + b)(1, 2)", 5590 "((a, b)\n=> a + b)(1, 2)",
5561 "((a, b)/*\n*/=> a + b)(1, 2)", 5591 "((a, b)/*\n*/=> a + b)(1, 2)",
5562 NULL}; 5592 NULL};
5563 static const ParserFlag always_flags[] = {kAllowHarmonyArrowFunctions}; 5593 static const ParserFlag always_flags[] = {kAllowHarmonyArrowFunctions};
5564 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 5594 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
5565 arraysize(always_flags)); 5595 arraysize(always_flags));
5566 } 5596 }
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/es6/block-let-declaration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698