INNER CODE UNIT · Python

_MockObjectPointerDiagnoser

hongliuliao/ehttp · deps/googletest/googlemock/scripts/gmock_doctor.py:357

def _MockObjectPointerDiagnoser(msg):
  """Diagnoses the MOP disease, given the error messages by the compiler."""

  gcc_regex = (_GCC_FILE_LINE_RE + r'error: request for member '
               r'\'gmock_(?P<method>.+)\' in \'(?P<mock_object>.+)\', '
               r'which is of non-class type \'(.*::)*(?P<class_name>.+)\*\'')
  clang_regex = (_CLANG_FILE_LINE_RE + r'error: member reference type '
                 r'\'(?P<class_name>.*?) *\' is a pointer; '
                 r'(did you mean|maybe you meant) to use \'->\'\?')
  diagnosis = """
The first argument to ON_CALL() and EXPECT_CALL() must be a mock *object*,
not a *pointer* to it.  Please write '*(%(mock_object)s)' instead of
'%(mock_object)s' as your first argument.

For example, given the mock class:

  class %(class_name)s : public ... {
    ...

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…