Two new suggestions

5 views
Skip to first unread message

Johnny

unread,
Apr 12, 2009, 3:30:48 AM4/12/09
to gmock-dev
1. Support mocking super calls. For example:

mock(something).super.someMethod()

Here some method of "something" would look like:

void doSomething() {
super.someMethod()
...
}

I'm not sure about this feature.

2. Support mocking one method with different parameters. For example:

mock.removeFromCache("test 1")
mock.removeFromCache("test 2")

can be reduced to

mock.removeFromCache("test 1")("test 2")

It actually calls the "call" method:

mock.removeFromCache("test 1").call("test 2")


Julien

unread,
Apr 12, 2009, 8:54:27 AM4/12/09
to gmock-dev
1. Yes we could think about doing it if it's not too complicated.

2. Not sure about that one. I would find it quite hard to spot if
someone is using it in a test.

Johnny

unread,
Apr 12, 2009, 9:30:41 AM4/12/09
to gmoc...@googlegroups.com
1. I have tried to use 'super' as a property name but failed:

class A {
def getSuper() { println 'super' }
}
def a = new A()
a.super // compilation error
a.'super' // no such property

So, we cannot do it unless we can find an alternate syntax.

2. I agree with you. Let's shelve it.

在 2009-04-12日的 05:54 -0700,Julien写道:

Johnny

unread,
Apr 19, 2009, 9:29:17 AM4/19/09
to gmoc...@googlegroups.com
I have some new ideas about the second suggestion.

If we introduce the "and" and "or" methods, it might be useful, for
example:

mock.methodA(1, 2).and(3, 4).returns(0)
// the above statement is equal to
// mock.methodA(1, 2).returns(0)
// mock.metohdA(3, 4).returns(0)

mock.methodB(1, 2).or(3, 4).returns(0)
// the above statement means that,
// mock.methodB(1, 2) 'or' mock.methodB(3, 4) will be called

Any thought?

在 2009-04-12日的 05:54 -0700,Julien写道:

Julien Gagnet

unread,
Apr 19, 2009, 10:13:26 AM4/19/09
to gmoc...@googlegroups.com
Yes that's seems like a good idea. We must however try to not
complexify to much the api or we risk to make GMock hard to learn.

Would you like to create an issue for it.

2009/4/19 Johnny <johnny...@gmail.com>:

Johnny

unread,
Apr 19, 2009, 10:20:14 AM4/19/09
to gmoc...@googlegroups.com
Done: http://code.google.com/p/gmock/issues/detail?id=82

Please decide the version.

在 2009-04-19日的 15:13 +0100,Julien Gagnet写道:
Reply all
Reply to author
Forward
0 new messages