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

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

Issue 203193004: Move ParseUnaryExpression into ParserBase and add tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: oops Created 6 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 | Annotate | Revision Log
« src/parser.h ('K') | « src/preparser.cc ('k') | no next file » | 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 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 2452
2453 const char* statement_data[] = { 2453 const char* statement_data[] = {
2454 statement, 2454 statement,
2455 NULL 2455 NULL
2456 }; 2456 };
2457 2457
2458 // The test is quite slow, so run it with a reduced set of flags. 2458 // The test is quite slow, so run it with a reduced set of flags.
2459 static const ParserFlag empty_flags[] = {kAllowLazy}; 2459 static const ParserFlag empty_flags[] = {kAllowLazy};
2460 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); 2460 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1);
2461 } 2461 }
2462
2463
2464 TEST(StrictDelete) {
2465 // "delete <Identifier>" is not allowed in strict mode.
2466 const char* strict_context_data[][2] = {
2467 {"\"use strict\"; ", ""},
2468 { NULL, NULL }
2469 };
2470
2471 const char* sloppy_context_data[][2] = {
2472 {"", ""},
2473 { NULL, NULL }
2474 };
2475
2476 // These are errors in the strict mode.
2477 const char* sloppy_statement_data[] = {
2478 "delete foo;",
2479 "delete foo + 1;",
2480 "delete (foo);",
2481 "delete eval;",
2482 "delete interface;",
2483 NULL
2484 };
2485
2486 // These are always OK
2487 const char* good_statement_data[] = {
2488 "delete this;",
2489 "delete 1;",
2490 "delete 1 + 2;",
2491 "delete foo();",
2492 "delete foo.bar;",
2493 "delete foo[bar];",
2494 "delete foo--;",
2495 "delete --foo;",
2496 "delete new foo();",
2497 "delete new foo(bar);",
2498 NULL
2499 };
2500
2501 // These are always errors
2502 const char* bad_statement_data[] = {
2503 "delete if;",
2504 NULL
2505 };
2506
2507 RunParserSyncTest(strict_context_data, sloppy_statement_data, kError);
2508 RunParserSyncTest(sloppy_context_data, sloppy_statement_data, kSuccess);
2509
2510 RunParserSyncTest(strict_context_data, good_statement_data, kSuccess);
2511 RunParserSyncTest(sloppy_context_data, good_statement_data, kSuccess);
2512
2513 RunParserSyncTest(strict_context_data, bad_statement_data, kError);
2514 RunParserSyncTest(sloppy_context_data, bad_statement_data, kError);
2515 }
OLDNEW
« src/parser.h ('K') | « src/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698