aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/gtest/internal/gtest-port.h8
-rw-r--r--test/gtest-death-test_test.cc29
-rw-r--r--test/gtest_repeat_test.cc4
3 files changed, 8 insertions, 33 deletions
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 1b7c6a73..8dbc2d03 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -249,11 +249,11 @@
// struct Foo {
// Foo() { ... }
// } GTEST_ATTRIBUTE_UNUSED;
-#if defined(GTEST_OS_WINDOWS) || (defined(GTEST_OS_LINUX) && defined(SWIG))
-#define GTEST_ATTRIBUTE_UNUSED
-#else
+#if defined(__GNUC__) && !defined(COMPILER_ICC)
#define GTEST_ATTRIBUTE_UNUSED __attribute__ ((unused))
-#endif // GTEST_OS_WINDOWS || (GTEST_OS_LINUX && SWIG)
+#else
+#define GTEST_ATTRIBUTE_UNUSED
+#endif
// A macro to disallow the evil copy constructor and operator= functions
// This should be used in the private: declarations for a class.
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc
index 4e4ca1a2..4bfd9d63 100644
--- a/test/gtest-death-test_test.cc
+++ b/test/gtest-death-test_test.cc
@@ -467,31 +467,6 @@ TEST_F(TestForDeathTest, TestExpectDebugDeath) {
#endif
}
-// Tests that EXPECT_DEBUG_DEATH works as expected,
-// that is, in debug mode, it:
-// 1. Asserts on death.
-// 2. Has no side effect.
-//
-// And in opt mode, it:
-// 1. Has side effects and returns the expected value (12).
-TEST_F(TestForDeathTest, TestExpectDebugDeathM) {
- int sideeffect = 0;
- EXPECT_DEBUG_DEATH({ // NOLINT
- // Tests that the return value is 12 in opt mode.
- EXPECT_EQ(12, DieInDebugElse12(&sideeffect));
- // Tests that the side effect occurrs in opt mode.
- EXPECT_EQ(12, sideeffect);
- }, "death.*DieInDebugElse12") << "In ExpectDebugDeathM";
-
-#ifdef NDEBUG
- // Checks that the assignment occurs in opt mode (sideeffect).
- EXPECT_EQ(12, sideeffect);
-#else
- // Checks that the assignment does not occur in dbg mode (no sideeffect).
- EXPECT_EQ(0, sideeffect);
-#endif
-}
-
// Tests that ASSERT_DEBUG_DEATH works as expected
// In debug mode:
// 1. Asserts on debug death.
@@ -499,7 +474,7 @@ TEST_F(TestForDeathTest, TestExpectDebugDeathM) {
//
// In opt mode:
// 1. Has side effects and returns the expected value (12).
-TEST_F(TestForDeathTest, TestAssertDebugDeathM) {
+TEST_F(TestForDeathTest, TestAssertDebugDeath) {
int sideeffect = 0;
ASSERT_DEBUG_DEATH({ // NOLINT
@@ -507,7 +482,7 @@ TEST_F(TestForDeathTest, TestAssertDebugDeathM) {
EXPECT_EQ(12, DieInDebugElse12(&sideeffect));
// Tests that the side effect occurred in opt mode.
EXPECT_EQ(12, sideeffect);
- }, "death.*DieInDebugElse12") << "In AssertDebugDeathM";
+ }, "death.*DieInDebugElse12");
#ifdef NDEBUG
// Checks that the assignment occurs in opt mode (sideeffect).
diff --git a/test/gtest_repeat_test.cc b/test/gtest_repeat_test.cc
index fa52442f..e2f03812 100644
--- a/test/gtest_repeat_test.cc
+++ b/test/gtest_repeat_test.cc
@@ -58,6 +58,8 @@ using testing::GTEST_FLAG(repeat);
namespace {
+// We need this when we are testing Google Test itself and therefore
+// cannot use Google Test assertions.
#define GTEST_CHECK_INT_EQ_(expected, actual) \
do {\
const int expected_val = (expected);\
@@ -130,8 +132,6 @@ void ResetCounts() {
// Checks that the count for each test is expected.
void CheckCounts(int expected) {
- // We cannot use Google Test assertions here since we are testing Google Test
- // itself.
GTEST_CHECK_INT_EQ_(expected, g_environment_set_up_count);
GTEST_CHECK_INT_EQ_(expected, g_environment_tear_down_count);
GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);