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

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

Issue 671913002: harmony-scoping: Allow 'const' iteration variables in strict mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
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 4187 matching lines...) Expand 10 before | Expand all | Expand 10 after
4198 4198
4199 const char* name_data[] = { 4199 const char* name_data[] = {
4200 "function* g() { ({yield}); }", 4200 "function* g() { ({yield}); }",
4201 NULL 4201 NULL
4202 }; 4202 };
4203 4203
4204 static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals}; 4204 static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals};
4205 RunParserSyncTest(context_data, name_data, kError, NULL, 0, 4205 RunParserSyncTest(context_data, name_data, kError, NULL, 0,
4206 always_flags, arraysize(always_flags)); 4206 always_flags, arraysize(always_flags));
4207 } 4207 }
4208
4209
4210 TEST(ConstParsingInForIn) {
4211 const char* context_data[][2] = {{"'use strict';", ""},
4212 {"function foo(){ 'use strict';", "}"},
4213 {NULL, NULL}};
4214
4215 const char* data[] = {"for(const x = 1; ; ) {}", "for(const x in [1,2,3]) {}",
rossberg 2014/10/23 09:44:54 Add a case like "for (const x = 1, y = 2; ; )".
Dmitry Lomov (no reviews) 2014/10/23 10:33:34 Done.
4216 "for(const x of [1,2,3]) {}", NULL};
4217 static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
4218 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
4219 arraysize(always_flags));
4220 }
4221
4222
4223 TEST(ConstParsingInForInError) {
4224 const char* context_data[][2] = {{"'use strict';", ""},
4225 {"function foo(){ 'use strict';", "}"},
4226 {NULL, NULL}};
4227
4228 const char* data[] = {
4229 "for(const x,y = 1; ; ) {}",
4230 "for(const x = 4 in [1,2,3]) {}",
4231 "for(const x = 4, y in [1,2,3]) {}",
4232 "for(const x = 4 of [1,2,3]) {}",
4233 "for(const x = 4, y of [1,2,3]) {}",
rossberg 2014/10/23 09:44:54 Add "for (const x, y in/of [])".
Dmitry Lomov (no reviews) 2014/10/23 10:33:34 Done.
4234 NULL};
4235 static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
4236 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
4237 arraysize(always_flags));
4238 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698