Closed DartBot closed 9 years ago
This comment was originally written by iz...@gmail.com
I have patched my local SDK and have found that this TODO is wrong.
invokeOn(value) will apply the InvocationMirror to the proxy closure which, of course, has not the same signature as the InvocationMirror.
The correct way to do this would be something like:
var args = invocation.positionalArguments; var nargs = invocation.namedArguments; var mirror = reflect(closure); mirror.invoke( "THIS IS THE MEMBER NAME, BUT IN THIS CASE THERE'S NO MEMBER NAME AS THIS IS A CLOSURE", args, nargs );
Which, anyway, doesn't work yet as invoke() with named arguments is not yet supported.
Can we please rename this bug to "support named arguments in mock proxies" and leave it open for further reference?
Originally opened as dart-lang/sdk#9613
This issue was originally filed by iz...@gmail.com
In line 1338 of mock.dart there's the next TODO:
// TODO(gram): Replace all this with: // var rtn = invocation.invokeOn(value); // once that is supported.
I believe invokeOn is already implemented. Can you remove the TODO and implement it correctly? Otherwise there's no way to mock method with named arguments.
Thanks.