Robert Nystrom | 5c13766 | 2020-06-09 10:52:04 +0000 | [diff] [blame] | 1 | // TODO(multitest): This was automatically migrated from a multitest and may |
| 2 | // contain strange or dead code. |
| 3 | |
| 4 | // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 5 | // for details. All rights reserved. Use of this source code is governed by a |
| 6 | // BSD-style license that can be found in the LICENSE file. |
| 7 | // Dart test program for testing bad named parameters. |
| 8 | |
| 9 | import "package:expect/expect.dart"; |
| 10 | |
| 11 | class BadNamedParametersTest { |
| 12 | int f42(int a, {int b: 20, int c: 30}) { |
| 13 | return 100 * (100 * a + b) + c; |
| 14 | } |
| 15 | |
| 16 | int f52(int a, {int b: 20, int? c, int d: 40}) { |
| 17 | return 100 * (100 * (100 * a + b) + (c == null ? 0 : c)) + d; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | main() { |
| 22 | BadNamedParametersTest np = new BadNamedParametersTest(); |
| 23 | |
| 24 | // Parameter b passed twice. |
| 25 | |
| 26 | |
| 27 | // Parameter x does not exist. |
| 28 | |
| 29 | |
| 30 | // Parameter b1 does not exist. |
| 31 | |
| 32 | |
| 33 | // Too many parameters. |
| 34 | |
| 35 | |
| 36 | // Too few parameters. |
| 37 | |
| 38 | } |