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 931223002: [strong] deprecate empty sub-statements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Another rebase & merge conflicts Created 5 years, 10 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
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 5499 matching lines...) Expand 10 before | Expand all | Expand 10 after
5510 always_flags, arraysize(always_flags)); 5510 always_flags, arraysize(always_flags));
5511 RunParserSyncTest(strict_context_data, let_declarations, kSuccess, NULL, 0, 5511 RunParserSyncTest(strict_context_data, let_declarations, kSuccess, NULL, 0,
5512 always_flags, arraysize(always_flags)); 5512 always_flags, arraysize(always_flags));
5513 5513
5514 RunParserSyncTest(sloppy_context_data, var_declarations, kSuccess, NULL, 0, 5514 RunParserSyncTest(sloppy_context_data, var_declarations, kSuccess, NULL, 0,
5515 always_flags, arraysize(always_flags)); 5515 always_flags, arraysize(always_flags));
5516 // At the moment, let declarations are only available in strict mode. 5516 // At the moment, let declarations are only available in strict mode.
5517 RunParserSyncTest(sloppy_context_data, let_declarations, kError, NULL, 0, 5517 RunParserSyncTest(sloppy_context_data, let_declarations, kError, NULL, 0,
5518 always_flags, arraysize(always_flags)); 5518 always_flags, arraysize(always_flags));
5519 } 5519 }
5520
5521
5522 TEST(StrongEmptySubStatements) {
5523 const char* sloppy_context_data[][2] = {{"", ""}, {NULL}};
5524 const char* strict_context_data[][2] = {{"'use strict';", ""}, {NULL}};
5525 const char* strong_context_data[][2] = {{"'use strong';", ""}, {NULL}};
5526
5527 const char* data[] = {
5528 "if (1);",
5529 "if (1) {} else;",
5530 "while (1);",
5531 "do; while (1);",
5532 "for (;;);",
5533 "for (x in []);",
5534 "for (x of []);",
5535 "for (const x = 0;;);",
5536 "for (const x in []);",
5537 "for (const x of []);",
5538 NULL};
5539
5540 static const ParserFlag always_flags[] = {
5541 kAllowStrongMode, kAllowHarmonyScoping
5542 };
5543 RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags,
5544 arraysize(always_flags));
5545 RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags,
5546 arraysize(always_flags));
5547 RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags,
5548 arraysize(always_flags));
5549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698