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

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

Issue 22918025: Make Invocation.positionalArguments and .namedArguments never be null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 7 years, 3 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 | « sdk/lib/core/invocation.dart ('k') | no next file » | 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 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Invocation and noSuchMethod testing. 7 // Invocation and noSuchMethod testing.
8 8
9 Map<Symbol, dynamic> listToNamedArguments(list) { 9 Map<Symbol, dynamic> listToNamedArguments(list) {
10 var iterator = list.iterator; 10 var iterator = list.iterator;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 "$name:positional[0]"); 66 "$name:positional[0]");
67 Expect.equals(0, im.namedArguments.length, "$name:#named"); 67 Expect.equals(0, im.namedArguments.length, "$name:#named");
68 return; 68 return;
69 } 69 }
70 Map<Symbol, dynamic> namedArguments = listToNamedArguments(named); 70 Map<Symbol, dynamic> namedArguments = listToNamedArguments(named);
71 Expect.isTrue(im.isMethod, "$name:isMethod"); 71 Expect.isTrue(im.isMethod, "$name:isMethod");
72 Expect.isFalse(im.isAccessor, "$name:isAccessor"); 72 Expect.isFalse(im.isAccessor, "$name:isAccessor");
73 Expect.isFalse(im.isSetter, "$name:isSetter"); 73 Expect.isFalse(im.isSetter, "$name:isSetter");
74 Expect.isFalse(im.isGetter, "$name:isGetter"); 74 Expect.isFalse(im.isGetter, "$name:isGetter");
75 75
76 Expect.equals(positional.length, im.positionalArguments.length); 76 Expect.listEquals(positional, im.positionalArguments);
77 for (int i = 0; i < positional.length; i++) { 77
78 Expect.equals(positional[i], im.positionalArguments[i],
79 "$name:positional[$i]");
80 }
81 Expect.equals(namedArguments.length, im.namedArguments.length, 78 Expect.equals(namedArguments.length, im.namedArguments.length,
82 "$name:#named"); 79 "$name:#named");
83 namedArguments.forEach((k, v) { 80 namedArguments.forEach((k, v) {
84 Expect.isTrue(im.namedArguments.containsKey(k), 81 Expect.isTrue(im.namedArguments.containsKey(k),
85 "$name:?namedArguments[$k]"); 82 "$name:?namedArguments[$k]");
86 Expect.equals(v, im.namedArguments[k], "$name:namedArguments[$k]"); 83 Expect.equals(v, im.namedArguments[k], "$name:namedArguments[$k]");
87 }); 84 });
88 } 85 }
89 86
90 87
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 test(() => o.hashCode = 42); 286 test(() => o.hashCode = 42);
290 test(() => o.hashCode()); // Thrown by int.noSuchMethod. 287 test(() => o.hashCode()); // Thrown by int.noSuchMethod.
291 test(() => (n.flif)()); // Extracted method has no noSuchMethod. 288 test(() => (n.flif)()); // Extracted method has no noSuchMethod.
292 } 289 }
293 290
294 main() { 291 main() {
295 testInvocationMirrors(); 292 testInvocationMirrors();
296 testNoSuchMethodErrors(); 293 testNoSuchMethodErrors();
297 new M().testSuperCalls(); 294 new M().testSuperCalls();
298 } 295 }
OLDNEW
« no previous file with comments | « sdk/lib/core/invocation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698