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

Unified Diff: pkg/unittest/lib/mock.dart

Issue 11363058: Fix mock library to use new noSuchMethod signature. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/pkg.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/mock.dart
===================================================================
--- pkg/unittest/lib/mock.dart (revision 14483)
+++ pkg/unittest/lib/mock.dart (working copy)
@@ -1278,8 +1278,13 @@
* return value. If we find no [Behavior] to apply an exception is
* thrown.
*/
- noSuchMethod(String method, List args) {
- if (method.startsWith('get:')) {
+ noSuchMethod(InvocationMirror invocation) {
+ var method = invocation.memberName;
+ var args = invocation.positionalArguments;
+ if (invocation.isGetter) {
+ method = 'get $method';
+ } else if (method.startsWith('get:')) {
+ // TODO(gram): Remove this when VM handles the isGetter version above.
method = 'get ${method.substring(4)}';
}
bool matchedMethodName = false;
@@ -1317,6 +1322,9 @@
}
throw value;
} else if (action == Action.PROXY) {
+ // TODO(gram): Replace all this with:
+ // var rtn = invocation.invokeOn(value);
+ // once that is supported.
var rtn;
switch (args.length) {
case 0:
« no previous file with comments | « pkg/pkg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698