cpp-testing / gmock.py

'Google Mock' mocks generator based on libclang
51 stars 29 forks source link

Problem with generating mocks for templates. #1

Closed lgromanowski closed 11 years ago

lgromanowski commented 11 years ago

Hi, at first thanks for cool gmock generator it's really useful! I found that generator has problems with generating mocks for templates, ie:

#ifndef FOO_H
#define FOO_H

template < class F >
struct Foo
{
  virtual ~Foo() {}
  virtual void bar(F* f = nullptr) = 0;
};

struct Baz
{
  template < class T >  void baz(T* t = nullptr)
  {
  }
};

class Generated
{
  virtual void generated(void* p = nullptr) = 0;
};

#endif /* FOO_H */

becomes:

#include <gmock/gmock.h>
#include "foo.h"

struct GeneratedMock : public Generated
{
    MOCK_METHOD1(generated, void(void *));
};