Closed GoogleCodeExporter closed 9 years ago
Fix in next release.
Original comment by JohnnyJianHY
on 11 Oct 2008 at 3:20
Leave the GMockController class external.
But, should the Mock class be external? That is, will users use it directly?
Original comment by JohnnyJianHY
on 11 Oct 2008 at 3:23
Original comment by JohnnyJianHY
on 12 Oct 2008 at 12:26
Mock shouldn't theoretically accessed directly. If they were people would also
have
to had them to the mocks list in the GMockController.
I had to use it directly in order to bypass the closure mocking lack.
Original comment by julien.g...@gmail.com
on 12 Oct 2008 at 1:42
"I had to use it directly in order to bypass the closure mocking lack."
Could you give an example?
Original comment by JohnnyJianHY
on 13 Oct 2008 at 1:25
Yes sure. This is again the runner example:
My code look something like this:
void doSomething(){
runner.remote {
run("println 'foo'")
}
}
What I did is something like:
class MockRunner extends Mock {
def runner(closure){
closure.setDelegate(this)
closure.call()
}
}
Then in my test I was able to do:
void test(){
def mockRunner = new MockRunner()
mocks.add(mockRunner)
mockRunner.run("println 'foo'")
play {
// replace the runner with the mock in the code and run it
}
}
Original comment by julien.g...@gmail.com
on 13 Oct 2008 at 5:44
On my previous example change:
class MockRunner extends Mock {
def runner(closure){
closure.setDelegate(this)
closure.call()
}
}
with
class MockRunner extends Mock {
def remote(closure){
closure.setDelegate(this)
closure.call()
}
}
Original comment by julien.g...@gmail.com
on 13 Oct 2008 at 5:45
OK, I will leave Mock external until we implement closure mocking.
Original comment by JohnnyJianHY
on 14 Oct 2008 at 1:43
Original comment by JohnnyJianHY
on 14 Oct 2008 at 1:01
Original comment by JohnnyJianHY
on 14 Oct 2008 at 2:53
Original issue reported on code.google.com by
JohnnyJianHY
on 1 Oct 2008 at 3:34