michaelernst / googlemock

Automatically exported from code.google.com/p/googlemock
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Print actual values instead of pointers when FieldMatcher is used #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
struct A {
  A(int a) : a_(a){}
  int a_;
};

struct Mock {
  MOCK_METHOD1(Foo, void(A*));
};

A tmp(10);
EXPECT_CALL(mock, Foo(Field(&A::a_, 5)));
mock.Foo(&tmp);

What is the expected output? 

 Expected arg #0: the given field is equal to 5
          Actual: 10

What do you see instead?

 Expected arg #0: the given field is equal to 5
          Actual: 0037FB48

Original issue reported on code.google.com by sto...@google.com on 20 Nov 2009 at 11:38

GoogleCodeExporter commented 9 years ago
We can make the implementation of Field() print the value of the field in
ExplainMatchResultTo().  We should do the same for matchers Property() and 
ResultOf().

Original comment by w...@google.com on 3 Dec 2009 at 4:51

GoogleCodeExporter commented 9 years ago
Fixed by Manuel Klimek.

Original comment by w...@google.com on 23 Mar 2010 at 7:29