| 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 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 const char* context_data[][2] = { | 2325 const char* context_data[][2] = { |
| 2326 {"", ""}, | 2326 {"", ""}, |
| 2327 {"var f =", ""}, | 2327 {"var f =", ""}, |
| 2328 { NULL, NULL } | 2328 { NULL, NULL } |
| 2329 }; | 2329 }; |
| 2330 | 2330 |
| 2331 const char* statement_data[] = { | 2331 const char* statement_data[] = { |
| 2332 "new foo bar", | 2332 "new foo bar", |
| 2333 "new ) foo", | 2333 "new ) foo", |
| 2334 "new ++foo", | 2334 "new ++foo", |
| 2335 // TODO(marja): Activate this test once the preparser checks correctly. | 2335 "new foo ++", |
| 2336 // "new foo ++", | |
| 2337 NULL | 2336 NULL |
| 2338 }; | 2337 }; |
| 2339 | 2338 |
| 2340 RunParserSyncTest(context_data, statement_data, kError); | 2339 RunParserSyncTest(context_data, statement_data, kError); |
| 2341 } | 2340 } |
| 2342 | 2341 |
| 2343 | 2342 |
| 2344 TEST(StrictObjectLiteralChecking) { | 2343 TEST(StrictObjectLiteralChecking) { |
| 2345 const char* strict_context_data[][2] = { | 2344 const char* strict_context_data[][2] = { |
| 2346 {"\"use strict\"; var myobject = {", "};"}, | 2345 {"\"use strict\"; var myobject = {", "};"}, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 RunParserSyncTest(sloppy_context_data, sloppy_statement_data, kSuccess); | 2520 RunParserSyncTest(sloppy_context_data, sloppy_statement_data, kSuccess); |
| 2522 | 2521 |
| 2523 RunParserSyncTest(strict_context_data, good_statement_data, kSuccess); | 2522 RunParserSyncTest(strict_context_data, good_statement_data, kSuccess); |
| 2524 RunParserSyncTest(sloppy_context_data, good_statement_data, kSuccess); | 2523 RunParserSyncTest(sloppy_context_data, good_statement_data, kSuccess); |
| 2525 | 2524 |
| 2526 RunParserSyncTest(strict_context_data, bad_statement_data, kError); | 2525 RunParserSyncTest(strict_context_data, bad_statement_data, kError); |
| 2527 RunParserSyncTest(sloppy_context_data, bad_statement_data, kError); | 2526 RunParserSyncTest(sloppy_context_data, bad_statement_data, kError); |
| 2528 } | 2527 } |
| 2529 | 2528 |
| 2530 | 2529 |
| 2531 TEST(ErrorInvalidLeftHandSide) { | 2530 TEST(InvalidLeftHandSide) { |
| 2532 const char* assignment_context_data[][2] = { | 2531 const char* assignment_context_data[][2] = { |
| 2533 // {"", " = 1;"}, | 2532 // {"", " = 1;"}, |
| 2534 // {"\"use strict\"; ", " = 1;"}, | 2533 // {"\"use strict\"; ", " = 1;"}, |
| 2535 { NULL, NULL } | 2534 { NULL, NULL } |
| 2536 }; | 2535 }; |
| 2537 | 2536 |
| 2538 const char* prefix_context_data[][2] = { | 2537 const char* prefix_context_data[][2] = { |
| 2539 {"++", ";"}, | 2538 {"++", ";"}, |
| 2540 {"\"use strict\"; ++", ";"}, | 2539 {"\"use strict\"; ++", ";"}, |
| 2541 {NULL, NULL}, | 2540 {NULL, NULL}, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2586 | 2585 |
| 2587 RunParserSyncTest(assignment_context_data, good_statement_data, kSuccess); | 2586 RunParserSyncTest(assignment_context_data, good_statement_data, kSuccess); |
| 2588 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); | 2587 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); |
| 2589 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, | 2588 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, |
| 2590 kError); | 2589 kError); |
| 2591 | 2590 |
| 2592 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); | 2591 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); |
| 2593 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); | 2592 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); |
| 2594 | 2593 |
| 2595 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); | 2594 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); |
| 2596 // TODO(marja): This doesn't work yet. | 2595 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); |
| 2597 // RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); | |
| 2598 } | 2596 } |
| OLD | NEW |