Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: tests/language/bad_named_parameters_test.dart

Issue 166433002: Revert "Fix language tests wrt. warnings." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/language/bad_named_parameters2_test.dart ('k') | tests/language/bit_operations_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 bad named parameters. 4 // Dart test program for testing bad named parameters.
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 8
9 class BadNamedParametersTest { 9 class BadNamedParametersTest {
10 10
11 int f42(int a, {int b: 20, int c: 30}) { 11 int f42(int a, {int b: 20, int c: 30}) {
12 return 100*(100*a + b) + c; 12 return 100*(100*a + b) + c;
13 } 13 }
14 14
15 int f52(int a, {int b: 20, int c, int d: 40}) { 15 int f52(int a, {int b: 20, int c, int d: 40}) {
16 return 100*(100*(100*a + b) + (c == null ? 0 : c)) + d; 16 return 100*(100*(100*a + b) + (c == null ? 0 : c)) + d;
17 } 17 }
18 18
19 static testMain() { 19 static testMain() {
20 BadNamedParametersTest np = new BadNamedParametersTest(); 20 BadNamedParametersTest np = new BadNamedParametersTest();
21 21
22 // Verify that NoSuchMethod is called after an error is detected. 22 // Verify that NoSuchMethod is called after an error is detected.
23 bool caught; 23 bool caught;
24 try { 24 try {
25 caught = false; 25 caught = false;
26 // Parameter b passed twice. 26 // Parameter b passed twice.
27 np.f42(10, 25, b:25); /// 01: static type warning 27 np.f42(10, 25, b:25); /// static type warning
28 } on NoSuchMethodError catch (e) { 28 } on NoSuchMethodError catch (e) {
29 caught = true; 29 caught = true;
30 } 30 }
31 Expect.equals(true, caught); /// 01: continued 31 Expect.equals(true, caught);
32 try { 32 try {
33 caught = false; 33 caught = false;
34 // Parameter x does not exist. 34 // Parameter x does not exist.
35 np.f42(10, 25, x:99); /// 02: static type warning 35 np.f42(10, 25, x:99); /// static type warning
36 } on NoSuchMethodError catch (e) { 36 } on NoSuchMethodError catch (e) {
37 caught = true; 37 caught = true;
38 } 38 }
39 Expect.equals(true, caught); /// 02: continued 39 Expect.equals(true, caught);
40 try { 40 try {
41 caught = false; 41 caught = false;
42 // Parameter b1 does not exist. 42 // Parameter b1 does not exist.
43 np.f52(10, b:25, b1:99, c:35); /// 03: static type warning 43 np.f52(10, b:25, b1:99, c:35); /// static type warning
44 } on NoSuchMethodError catch (e) { 44 } on NoSuchMethodError catch (e) {
45 caught = true; 45 caught = true;
46 } 46 }
47 Expect.equals(true, caught); /// 03: continued 47 Expect.equals(true, caught);
48 try { 48 try {
49 caught = false; 49 caught = false;
50 // Too many parameters. 50 // Too many parameters.
51 np.f42(10, 20, 30, 40); /// 04: static type warning 51 np.f42(10, 20, 30, 40); /// static type warning
52 } on NoSuchMethodError catch (e) { 52 } on NoSuchMethodError catch (e) {
53 caught = true; 53 caught = true;
54 } 54 }
55 Expect.equals(true, caught); /// 04: continued 55 Expect.equals(true, caught);
56 try { 56 try {
57 caught = false; 57 caught = false;
58 // Too few parameters. 58 // Too few parameters.
59 np.f42(b:25); /// 05: static type warning 59 np.f42(b:25); /// static type warning
60 } on NoSuchMethodError catch (e) { 60 } on NoSuchMethodError catch (e) {
61 caught = true; 61 caught = true;
62 } 62 }
63 Expect.equals(true, caught); /// 05: continued 63 Expect.equals(true, caught);
64 } 64 }
65 } 65 }
66 66
67 main() { 67 main() {
68 BadNamedParametersTest.testMain(); 68 BadNamedParametersTest.testMain();
69 } 69 }
OLDNEW
« no previous file with comments | « tests/language/bad_named_parameters2_test.dart ('k') | tests/language/bit_operations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698