| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test program for testing named parameters with various values that might | 7 // Dart test program for testing named parameters with various values that might |
| 8 // be implemented as 'falsy' values in a JavaScript implementation. | 8 // be implemented as 'falsy' values in a JavaScript implementation. |
| 9 | 9 |
| 10 | |
| 11 class TestClass { | 10 class TestClass { |
| 12 TestClass(); | 11 TestClass(); |
| 13 | 12 |
| 14 method([value = 100]) => value; | 13 method([value = 100]) => value; |
| 15 method2({value: 100}) => value; | 14 method2({value: 100}) => value; |
| 16 | 15 |
| 17 static staticMethod([value = 200]) => value; | 16 static staticMethod([value = 200]) => value; |
| 18 static staticMethod2({value: 200}) => value; | 17 static staticMethod2({value: 200}) => value; |
| 19 } | 18 } |
| 20 | 19 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 48 Expect.equals(v, TestClass.staticMethod2(value: v)); | 47 Expect.equals(v, TestClass.staticMethod2(value: v)); |
| 49 Expect.equals(v, globalMethod(v)); | 48 Expect.equals(v, globalMethod(v)); |
| 50 Expect.equals(v, globalMethod2(value: v)); | 49 Expect.equals(v, globalMethod2(value: v)); |
| 51 } | 50 } |
| 52 | 51 |
| 53 // Test via indirect call. | 52 // Test via indirect call. |
| 54 testFunction(obj.method, obj.method2); | 53 testFunction(obj.method, obj.method2); |
| 55 testFunction(TestClass.staticMethod, TestClass.staticMethod2); | 54 testFunction(TestClass.staticMethod, TestClass.staticMethod2); |
| 56 testFunction(globalMethod, globalMethod2); | 55 testFunction(globalMethod, globalMethod2); |
| 57 } | 56 } |
| OLD | NEW |