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

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

Issue 418143007: FYI Implementing 'super' keyword (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: one more test Created 6 years, 4 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 3329 matching lines...) Expand 10 before | Expand all | Expand 10 after
3340 3340
3341 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {}) 3341 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {})
3342 "foo ? bar : baz => {}", 3342 "foo ? bar : baz => {}",
3343 NULL 3343 NULL
3344 }; 3344 };
3345 3345
3346 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 3346 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
3347 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 3347 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
3348 always_flags, ARRAY_SIZE(always_flags)); 3348 always_flags, ARRAY_SIZE(always_flags));
3349 } 3349 }
3350
3351
3352 TEST(NoErrorsSuper) {
3353 // Tests that parser and preparser accept valid arrow functions syntax.
marja 2014/08/11 10:38:15 Nit: this comment is out of date.
3354 const char* context_data[][2] = {{"", ";"},
marja 2014/08/11 10:38:15 You can probably get rid of some of the contexts o
3355 {"bar ? (", ") : baz;"},
3356 {"bar ? baz : (", ");"},
3357 {"bar, ", ";"},
3358 {"", ", bar;"},
3359 {NULL, NULL}};
3360
3361 const char* statement_data[] = {
3362 "super.x",
3363 "super[27]",
3364 "new super",
3365 "new super()",
3366 "new super(12, 45)",
3367 "new new super",
3368 "new new super()",
3369 "new new super()()",
3370 NULL};
3371
3372 RunParserSyncTest(context_data, statement_data, kSuccess);
3373 }
3374
3375
3376 TEST(ErrorsSuper) {
3377 // Tests that parser and preparser accept valid arrow functions syntax.
marja 2014/08/11 10:38:15 Same here.
3378 const char* context_data[][2] = {{"", ";"},
3379 {"bar ? (", ") : baz;"},
3380 {"bar ? baz : (", ");"},
3381 {"bar, ", ";"},
3382 {"", ", bar;"},
3383 {NULL, NULL}};
3384
3385 const char* statement_data[] = {
3386 "super = x",
3387 "y = super",
3388 "f(super)",
3389 // "z.super",
3390 NULL};
3391
3392 RunParserSyncTest(context_data, statement_data, kError);
3393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698