google / google/googletest

gmock_gen.py generates template types with a wrong name

Open
#3,172 1 comment 0 reactions 1 assignee Claimed by @derekmauro View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

The otherwise very useful `gmock_gen.py` script does not produce _correct_ mocks when used with interfaces that contain template types that are used in the signature of one or more functions.

For example, when trying to generate a mock out of the following header:
```cpp
#pragma once

template
class FooBar {
public:
virtual void bar(T t);
};
```

The script's output is:
```cpp
template
class MockFooBar : public FooBar {
public:
MOCK_METHOD(void, bar, (T t), (override));
};
```

The expected output would be something that compiles, e.g.:
```cpp
```cpp
template
class MockFooBar : public FooBar {
public:
MOCK_METHOD(void, bar, (T t), (override));
};
```
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.