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 // Dart test program for testing argument definition test. | 4 // Dart test program for testing argument definition test. |
5 | 5 |
| 6 import "package:expect/expect.dart"; |
| 7 |
6 int test(int a, {int b: 2, int c: 3}) { | 8 int test(int a, {int b: 2, int c: 3}) { |
7 int result = 0; | 9 int result = 0; |
8 ?b; | 10 ?b; |
9 ?result; /// 01: compile-time error | 11 ?result; /// 01: compile-time error |
10 if (?a) { | 12 if (?a) { |
11 result += 100; | 13 result += 100; |
12 } | 14 } |
13 if (?b) { | 15 if (?b) { |
14 result += 20; | 16 result += 20; |
15 } | 17 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 69 |
68 Expect.equals(100, closure_test(1)()); | 70 Expect.equals(100, closure_test(1)()); |
69 Expect.equals(720, closure_test(1, b: 2)()); | 71 Expect.equals(720, closure_test(1, b: 2)()); |
70 Expect.equals(523, closure_test(1, b: 2, c: 3)()); | 72 Expect.equals(523, closure_test(1, b: 2, c: 3)()); |
71 Expect.equals(703, closure_test(1, c: 3)()); | 73 Expect.equals(703, closure_test(1, c: 3)()); |
72 | 74 |
73 Expect.equals(true, tl_test(0)); | 75 Expect.equals(true, tl_test(0)); |
74 Expect.equals(false, tl_test()); | 76 Expect.equals(false, tl_test()); |
75 } | 77 } |
76 } | 78 } |
OLD | NEW |