summaryrefslogtreecommitdiffstats
path: root/googlemock/test
diff options
context:
space:
mode:
authorJoshua Cannon <joshdcannon@gmail.com>2019-10-07 19:30:10 (GMT)
committerJoshua Cannon <joshdcannon@gmail.com>2019-10-07 19:30:10 (GMT)
commit10c1d8c4faed0b90670a4971cf80a75d552d6f22 (patch)
treee0bf69698a7c6387dbd893c789f8500caa534fd4 /googlemock/test
parent76a560c81cfe75cc6f9ff0c4a37ea3d1ce1229ed (diff)
downloadgoogletest-10c1d8c4faed0b90670a4971cf80a75d552d6f22.zip
googletest-10c1d8c4faed0b90670a4971cf80a75d552d6f22.tar.gz
googletest-10c1d8c4faed0b90670a4971cf80a75d552d6f22.tar.bz2
Use the verbatim noexcept spec in MOCKED_METHOD
Diffstat (limited to 'googlemock/test')
-rw-r--r--googlemock/test/gmock-function-mocker_test.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc
index fbc5d5b..4b41437 100644
--- a/googlemock/test/gmock-function-mocker_test.cc
+++ b/googlemock/test/gmock-function-mocker_test.cc
@@ -656,5 +656,26 @@ TEST(MockMethodMockFunctionTest, MockMethodSizeOverhead) {
EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes4));
}
+struct MockMethodNoexceptSpecifier {
+ MOCK_METHOD(void, func1, (), (noexcept));
+ MOCK_METHOD(void, func2, (), (noexcept(true)));
+ MOCK_METHOD(void, func3, (), (noexcept(false)));
+ MOCK_METHOD(void, func4, (), (noexcept(noexcept(1+1))));
+ MOCK_METHOD(void, func5, (), (const, noexcept(noexcept(1+1))));
+ MOCK_METHOD(void, func6, (), (noexcept(noexcept(1+1)), const));
+ // Put commas in the noexcept expression
+ MOCK_METHOD(void, func7, (), (noexcept(noexcept(1,2,3)), const));
+};
+
+TEST(MockMethodMockFunctionTest, NoexceptSpecifierPreserved) {
+ EXPECT_TRUE(noexcept(MockMethodNoexceptSpecifier{}.func1()));
+ EXPECT_TRUE(noexcept(MockMethodNoexceptSpecifier{}.func2()));
+ EXPECT_FALSE(noexcept(MockMethodNoexceptSpecifier{}.func3()));
+ EXPECT_EQ(noexcept(MockMethodNoexceptSpecifier{}.func4()), noexcept(1+1));
+ EXPECT_EQ(noexcept(MockMethodNoexceptSpecifier{}.func5()), noexcept(1+1));
+ EXPECT_EQ(noexcept(MockMethodNoexceptSpecifier{}.func6()), noexcept(1+1));
+ EXPECT_EQ(noexcept(MockMethodNoexceptSpecifier{}.func7()), noexcept(1,2,3));
+}
+
} // namespace gmock_function_mocker_test
} // namespace testing