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