OLD | NEW |
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 // Flags: --harmony-default-parameters --harmony-arrow-functions | 5 // Flags: --harmony-default-parameters |
6 // Flags: --harmony-rest-parameters --harmony-destructuring | 6 // Flags: --harmony-rest-parameters --harmony-destructuring |
7 | 7 |
8 | 8 |
9 (function TestDefaults() { | 9 (function TestDefaults() { |
10 function f1(x = 1) { return x } | 10 function f1(x = 1) { return x } |
11 assertEquals(1, f1()); | 11 assertEquals(1, f1()); |
12 assertEquals(1, f1(undefined)); | 12 assertEquals(1, f1(undefined)); |
13 assertEquals(2, f1(2)); | 13 assertEquals(2, f1(2)); |
14 assertEquals(null, f1(null)); | 14 assertEquals(null, f1(null)); |
15 | 15 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 assertThrows(function(){ eval("(x=1) => {'use strict';}") }, SyntaxError); | 450 assertThrows(function(){ eval("(x=1) => {'use strict';}") }, SyntaxError); |
451 assertThrows( | 451 assertThrows( |
452 function(){ eval("(class{foo(x=1) {'use strict';}});") }, SyntaxError); | 452 function(){ eval("(class{foo(x=1) {'use strict';}});") }, SyntaxError); |
453 | 453 |
454 assertThrows( | 454 assertThrows( |
455 function(){ eval("function(a, x=1){'use strict';}") }, SyntaxError); | 455 function(){ eval("function(a, x=1){'use strict';}") }, SyntaxError); |
456 assertThrows(function(){ eval("(a, x=1) => {'use strict';}") }, SyntaxError); | 456 assertThrows(function(){ eval("(a, x=1) => {'use strict';}") }, SyntaxError); |
457 assertThrows( | 457 assertThrows( |
458 function(){ eval("(class{foo(a, x=1) {'use strict';}});") }, SyntaxError); | 458 function(){ eval("(class{foo(a, x=1) {'use strict';}});") }, SyntaxError); |
459 })(); | 459 })(); |
OLD | NEW |