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

Side by Side Diff: test/mjsunit/es6/default-parameters.js

Issue 2229243002: Destructuring/default tests for generators and async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add additional suggested test Created 4 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
« no previous file with comments | « no previous file | test/mjsunit/es6/destructuring.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 (function TestDefaults() { 6 (function TestDefaults() {
7 function f1(x = 1) { return x } 7 function f1(x = 1) { return x }
8 assertEquals(1, f1()); 8 assertEquals(1, f1());
9 assertEquals(1, f1(undefined)); 9 assertEquals(1, f1(undefined));
10 assertEquals(2, f1(2)); 10 assertEquals(2, f1(2));
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 assertEquals(2, (function(x, y, z = 1, ...a) {}).length); 343 assertEquals(2, (function(x, y, z = 1, ...a) {}).length);
344 assertEquals(1, (function(x, y = 1, z) {}).length); 344 assertEquals(1, (function(x, y = 1, z) {}).length);
345 assertEquals(1, (function(x, y = 1, z, ...a) {}).length); 345 assertEquals(1, (function(x, y = 1, z, ...a) {}).length);
346 assertEquals(1, (function(x, y = 1, z, v = 2) {}).length); 346 assertEquals(1, (function(x, y = 1, z, v = 2) {}).length);
347 assertEquals(1, (function(x, y = 1, z, v = 2, ...a) {}).length); 347 assertEquals(1, (function(x, y = 1, z, v = 2, ...a) {}).length);
348 })(); 348 })();
349 349
350 (function TestDirectiveThrows() { 350 (function TestDirectiveThrows() {
351 "use strict"; 351 "use strict";
352 352
353 assertThrows(function(){ eval("function(x=1){'use strict';}") }, SyntaxError); 353 assertThrows("(function(x=1){'use strict';})", SyntaxError);
354 assertThrows(function(){ eval("(x=1) => {'use strict';}") }, SyntaxError); 354 assertThrows("(x=1) => {'use strict';}", SyntaxError);
355 assertThrows( 355 assertThrows("(class{foo(x=1) {'use strict';}});", SyntaxError);
356 function(){ eval("(class{foo(x=1) {'use strict';}});") }, SyntaxError);
357 356
358 assertThrows( 357 assertThrows("(function(a, x=1){'use strict';})", SyntaxError);
359 function(){ eval("function(a, x=1){'use strict';}") }, SyntaxError); 358 assertThrows("(a, x=1) => {'use strict';}", SyntaxError);
360 assertThrows(function(){ eval("(a, x=1) => {'use strict';}") }, SyntaxError); 359 assertThrows("(class{foo(a, x=1) {'use strict';}});", SyntaxError);
361 assertThrows( 360
362 function(){ eval("(class{foo(a, x=1) {'use strict';}});") }, SyntaxError); 361 assertThrows("(function({x}){'use strict';})", SyntaxError);
362 assertThrows("({x}) => {'use strict';}", SyntaxError);
363 assertThrows("(class{foo({x}) {'use strict';}});", SyntaxError);
363 })(); 364 })();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/destructuring.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698