| 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 // Test to stress Frog's named parameter scheme. | 5 // Test to stress Frog's named parameter scheme. |
| 6 | 6 |
| 7 main() { | 7 main() { |
| 8 testDollar(); | 8 testDollar(); |
| 9 testPsycho(); | 9 testPsycho(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 class TestClass { | 12 class TestClass { |
| 13 method([a, b, a$b, a$$b]) => [a, b, a$b, a$$b]; | 13 method({a, b, a$b, a$$b}) => [a, b, a$b, a$$b]; |
| 14 | 14 |
| 15 psycho([$, $$, $$$, $$$$]) => [$, $$, $$$, $$$$]; | 15 psycho({$, $$, $$$, $$$$}) => [$, $$, $$$, $$$$]; |
| 16 } | 16 } |
| 17 globalMethod([a, b, a$b, a$$b]) => [a, b, a$b, a$$b]; | 17 globalMethod({a, b, a$b, a$$b}) => [a, b, a$b, a$$b]; |
| 18 | 18 |
| 19 | 19 |
| 20 format(thing) { | 20 format(thing) { |
| 21 if (thing == null) return '-'; | 21 if (thing == null) return '-'; |
| 22 if (thing is List) { | 22 if (thing is List) { |
| 23 var fragments = ['[']; | 23 var fragments = ['[']; |
| 24 var sep; | 24 var sep; |
| 25 for (final item in thing) { | 25 for (final item in thing) { |
| 26 if (sep != null) fragments.add(sep); | 26 if (sep != null) fragments.add(sep); |
| 27 sep = ', '; | 27 sep = ', '; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 Expect.equals('[1, 2, -, -]', format(t.psycho($:1, $$:2))); | 75 Expect.equals('[1, 2, -, -]', format(t.psycho($:1, $$:2))); |
| 76 Expect.equals('[-, -, -, 4]', format(t.psycho($$$$: 4))); | 76 Expect.equals('[-, -, -, 4]', format(t.psycho($$$$: 4))); |
| 77 | 77 |
| 78 var obj = makeTestClass(0); | 78 var obj = makeTestClass(0); |
| 79 | 79 |
| 80 Expect.equals('[1, 2, -, -]', format(obj.psycho($:1, $$:2))); | 80 Expect.equals('[1, 2, -, -]', format(obj.psycho($:1, $$:2))); |
| 81 Expect.equals('[-, -, -, 4]', format(obj.psycho($$$$: 4))); | 81 Expect.equals('[-, -, -, 4]', format(obj.psycho($$$$: 4))); |
| 82 Expect.equals('[1, 2, 3, -]', format(obj.psycho($:1, $$:2, $$$:3))); | 82 Expect.equals('[1, 2, 3, -]', format(obj.psycho($:1, $$:2, $$$:3))); |
| 83 Expect.equals('[1, 2, 3, -]', format(obj.psycho($$$:3, $$:2, $:1))); | 83 Expect.equals('[1, 2, 3, -]', format(obj.psycho($$$:3, $$:2, $:1))); |
| 84 } | 84 } |
| OLD | NEW |