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

Side by Side Diff: dart/pkg/unittest/lib/mock.dart

Issue 14049009: Rename Invocation to InvocationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged Created 7 years, 8 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 | « dart/pkg/pkg.status ('k') | dart/runtime/lib/invocation_mirror_patch.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 4
5 /** 5 /**
6 * A simple mocking/spy library. 6 * A simple mocking/spy library.
7 * 7 *
8 * To create a mock objects for some class T, create a new class using: 8 * To create a mock objects for some class T, create a new class using:
9 * 9 *
10 * class MockT extends Mock implements T {}; 10 * class MockT extends Mock implements T {};
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 } 1285 }
1286 } 1286 }
1287 1287
1288 /** 1288 /**
1289 * This is the handler for method calls. We loop through the list 1289 * This is the handler for method calls. We loop through the list
1290 * of [Behavior]s, and find the first match that still has return 1290 * of [Behavior]s, and find the first match that still has return
1291 * values available, and then do the action specified by that 1291 * values available, and then do the action specified by that
1292 * return value. If we find no [Behavior] to apply an exception is 1292 * return value. If we find no [Behavior] to apply an exception is
1293 * thrown. 1293 * thrown.
1294 */ 1294 */
1295 noSuchMethod(InvocationMirror invocation) { 1295 noSuchMethod(Invocation invocation) {
1296 var method = invocation.memberName; 1296 var method = invocation.memberName;
1297 var args = invocation.positionalArguments; 1297 var args = invocation.positionalArguments;
1298 if (invocation.isGetter) { 1298 if (invocation.isGetter) {
1299 method = 'get $method'; 1299 method = 'get $method';
1300 } else if (invocation.isSetter) { 1300 } else if (invocation.isSetter) {
1301 method = 'set $method'; 1301 method = 'set $method';
1302 // Remove the trailing '='. 1302 // Remove the trailing '='.
1303 if (method[method.length-1] == '=') { 1303 if (method[method.length-1] == '=') {
1304 method = method.substring(0, method.length - 1); 1304 method = method.substring(0, method.length - 1);
1305 } 1305 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 } 1479 }
1480 } 1480 }
1481 } 1481 }
1482 1482
1483 /** Clear both logs and behavior. */ 1483 /** Clear both logs and behavior. */
1484 void reset() { 1484 void reset() {
1485 resetBehavior(); 1485 resetBehavior();
1486 clearLogs(); 1486 clearLogs();
1487 } 1487 }
1488 } 1488 }
OLDNEW
« no previous file with comments | « dart/pkg/pkg.status ('k') | dart/runtime/lib/invocation_mirror_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698