aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/generator/cpp/gmock_class_test.py
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2014-11-17 02:49:22 +0000
committerkosak <kosak@google.com>2014-11-17 02:49:22 +0000
commit61adbcc5c6b8e0385e3e2bf4262771d20a375002 (patch)
tree59e9d99433365685738be11c4dda1b1352260d6a /scripts/generator/cpp/gmock_class_test.py
parent055b6b17d2354691af4b20f035f36c134fba2ac9 (diff)
downloadgoogletest-61adbcc5c6b8e0385e3e2bf4262771d20a375002.tar.gz
googletest-61adbcc5c6b8e0385e3e2bf4262771d20a375002.tar.bz2
googletest-61adbcc5c6b8e0385e3e2bf4262771d20a375002.zip
Add support for C++11 explicitly defaulted and deleted special member functions in the gmock generator.
Diffstat (limited to 'scripts/generator/cpp/gmock_class_test.py')
-rwxr-xr-xscripts/generator/cpp/gmock_class_test.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/scripts/generator/cpp/gmock_class_test.py b/scripts/generator/cpp/gmock_class_test.py
index ae3739af..27eb86c8 100755
--- a/scripts/generator/cpp/gmock_class_test.py
+++ b/scripts/generator/cpp/gmock_class_test.py
@@ -65,6 +65,68 @@ class Foo {
'MOCK_METHOD0(Bar,\nint());',
self.GenerateMethodSource(source))
+ def testSimpleConstructorsAndDestructor(self):
+ source = """
+class Foo {
+ public:
+ Foo();
+ Foo(int x);
+ Foo(const Foo& f);
+ Foo(Foo&& f);
+ ~Foo();
+ virtual int Bar() = 0;
+};
+"""
+ # The constructors and destructor should be ignored.
+ self.assertEqualIgnoreLeadingWhitespace(
+ 'MOCK_METHOD0(Bar,\nint());',
+ self.GenerateMethodSource(source))
+
+ def testVirtualDestructor(self):
+ source = """
+class Foo {
+ public:
+ virtual ~Foo();
+ virtual int Bar() = 0;
+};
+"""
+ # The destructor should be ignored.
+ self.assertEqualIgnoreLeadingWhitespace(
+ 'MOCK_METHOD0(Bar,\nint());',
+ self.GenerateMethodSource(source))
+
+ def testExplicitlyDefaultedConstructorsAndDestructor(self):
+ source = """
+class Foo {
+ public:
+ Foo() = default;
+ Foo(const Foo& f) = default;
+ Foo(Foo&& f) = default;
+ ~Foo() = default;
+ virtual int Bar() = 0;
+};
+"""
+ # The constructors and destructor should be ignored.
+ self.assertEqualIgnoreLeadingWhitespace(
+ 'MOCK_METHOD0(Bar,\nint());',
+ self.GenerateMethodSource(source))
+
+ def testExplicitlyDeletedConstructorsAndDestructor(self):
+ source = """
+class Foo {
+ public:
+ Foo() = delete;
+ Foo(const Foo& f) = delete;
+ Foo(Foo&& f) = delete;
+ ~Foo() = delete;
+ virtual int Bar() = 0;
+};
+"""
+ # The constructors and destructor should be ignored.
+ self.assertEqualIgnoreLeadingWhitespace(
+ 'MOCK_METHOD0(Bar,\nint());',
+ self.GenerateMethodSource(source))
+
def testSimpleOverrideMethod(self):
source = """
class Foo {