> Alan,
>
> I don't think that's a valid argument. You can comment out
> asserts/expectations from any tests and they will of course pass.
>
> The point is to verify send is never called at all for those event types. And
> that it is called for other event types. I just re-tested changing "Times(0)"
> to "Times(1)" and the test then fails. So the test is correct.
Sorry, I wasn't clear.
The canonical way to write a test is /1/ setup, /2/ expectations, /3/ execution and /4/ validation.
You've mixed expectations and execution - but that doesn't change the way the fact that validation only occurs at the end. Essentially you've written:
TEST(TestEventSender, sends_all_but_input_events)
{
using namespace testing;
> Alan, expectations from any tests and they will of course pass.
>
> I don't think that's a valid argument. You can comment out
> asserts/
>
> The point is to verify send is never called at all for those event types. And
> that it is called for other event types. I just re-tested changing "Times(0)"
> to "Times(1)" and the test then fails. So the test is correct.
Sorry, I wasn't clear.
The canonical way to write a test is /1/ setup, /2/ expectations, /3/ execution and /4/ validation.
You've mixed expectations and execution - but that doesn't change the way the fact that validation only occurs at the end. Essentially you've written:
TEST(TestEventS ender, sends_all_ but_input_ events)
{
using namespace testing;
// Setup shared< MockMsgSender> (); :EventSender event_sender( msg_sender) ;
auto msg_sender = std::make_
mfd:
MirEvent event;
memset(&event, 0, sizeof event);
// Expectations CALL(*msg_ sender, send(_))
InSequence seq;
EXPECT_
.Times(2);
// Execution type_surface; sender. handle_ event(event) ; type_resize; sender. handle_ event(event) ; sender. handle_ event(event) ; type_motion; sender. handle_ event(event) ;
event.type = mir_event_
event_
event.type = mir_event_
event_
event.type = mir_event_type_key;
event_
event.type = mir_event_
event_
}
Which doesn't give any information on which events generate which calls - just that there are two of them.