| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 apply(Function function, List positional, Map<Symbol, dynamic> named) { | 7 apply(Function function, List positional, Map<Symbol, dynamic> named) { |
| 8 return Function.apply(function, positional, named); | 8 return Function.apply(function, positional, named); |
| 9 } | 9 } |
| 10 | 10 |
| 11 void throwsNSME(function, positional, named) { | 11 void throwsNSME(function, positional, named) { |
| 12 Expect.throws(() => apply(function, positional, named), | 12 Expect.throws( |
| 13 (e) => e is NoSuchMethodError); | 13 () => apply(function, positional, named), (e) => e is NoSuchMethodError); |
| 14 } | 14 } |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 var c1 = () => 'c1'; | 17 var c1 = () => 'c1'; |
| 18 var c2 = (a) => 'c2 $a'; | 18 var c2 = (a) => 'c2 $a'; |
| 19 var c3 = ([a = 1]) => 'c3 $a'; | 19 var c3 = ([a = 1]) => 'c3 $a'; |
| 20 var c4 = ({a: 1}) => 'c4 $a'; | 20 var c4 = ({a: 1}) => 'c4 $a'; |
| 21 var c5 = ({a: 1, b: 2}) => 'c5 $a $b'; | 21 var c5 = ({a: 1, b: 2}) => 'c5 $a $b'; |
| 22 var c6 = ({b: 1, a: 2}) => 'c6 $a $b'; | 22 var c6 = ({b: 1, a: 2}) => 'c6 $a $b'; |
| 23 var c7 = (x, {b: 1, a: 2}) => 'c7 $x $a $b'; | 23 var c7 = (x, {b: 1, a: 2}) => 'c7 $x $a $b'; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 Expect.equals('c8 7 8 2 3', apply(c8, [7, 8], null)); | 88 Expect.equals('c8 7 8 2 3', apply(c8, [7, 8], null)); |
| 89 Expect.equals('c8 7 8 2 3', apply(c8, [7, 8], {})); | 89 Expect.equals('c8 7 8 2 3', apply(c8, [7, 8], {})); |
| 90 Expect.equals('c8 7 8 3 3', apply(c8, [7, 8, 3], null)); | 90 Expect.equals('c8 7 8 3 3', apply(c8, [7, 8, 3], null)); |
| 91 Expect.equals('c8 7 8 3 4', apply(c8, [7, 8, 3, 4], null)); | 91 Expect.equals('c8 7 8 3 4', apply(c8, [7, 8, 3, 4], null)); |
| 92 throwsNSME(c8, [], null); | 92 throwsNSME(c8, [], null); |
| 93 throwsNSME(c8, [], {}); | 93 throwsNSME(c8, [], {}); |
| 94 throwsNSME(c8, [1], null); | 94 throwsNSME(c8, [1], null); |
| 95 throwsNSME(c8, [7, 8, 9, 10, 11], null); | 95 throwsNSME(c8, [7, 8, 9, 10, 11], null); |
| 96 } | 96 } |
| OLD | NEW |