Browse Source

[1698-test] Address issues raised by re-review

1. Enclose death tests within suitable #ifdef for systems that don't
   support them.
2. Minor comment changes.
Stephen Morris 13 years ago
parent
commit
292fc936f6

+ 2 - 3
src/lib/log/message_initializer.h

@@ -81,9 +81,8 @@ public:
 
     /// \brief Obtain pending load count
     ///
-    /// Returns a count of the message of message arrays that have been
-    /// registered with this class and will be loaded with the next call
-    /// to loadDictionary().
+    /// Returns the number of message arrays that will be loaded by the next
+    /// call to loadDictionary().
     ///
     /// \return Number of registered message arrays.  This is reset to zero
     ///         when loadDictionary() is called.

+ 5 - 2
src/lib/log/tests/logger_unittest.cc

@@ -363,12 +363,15 @@ TEST_F(LoggerTest, LoggerNameLength) {
     Logger l2(ok2.c_str());
     EXPECT_EQ(getRootLoggerName() + "." + ok2, l2.getName());
 
+    // Note: Not all systems have EXPECT_DEATH.  As it is a macro we can just
+    // test for its presence and bypass the test if not available.
+#ifdef EXPECT_DEATH
     // Too long a logger name should trigger an assertion failure.
     // Note that we just check that it dies - we don't check what message is
     // output.
-    ASSERT_DEATH({
+    EXPECT_DEATH({
                     string ok3(Logger::MAX_LOGGER_NAME_SIZE + 1, 'x');
                     Logger l3(ok3.c_str());
                  }, ".*");
-
+#endif
 }

+ 4 - 4
src/lib/log/tests/message_initializer_1_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -12,11 +12,11 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#include <string>
-#include <gtest/gtest.h>
-#include <boost/lexical_cast.hpp>
 #include <log/message_dictionary.h>
 #include <log/message_initializer.h>
+#include <boost/lexical_cast.hpp>
+#include <gtest/gtest.h>
+#include <string>
 
 using namespace isc;
 using namespace isc::log;

+ 1 - 1
src/lib/log/tests/message_initializer_1a_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above

+ 7 - 3
src/lib/log/tests/message_initializer_2_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -12,8 +12,8 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#include <gtest/gtest.h>
 #include <log/message_initializer.h>
+#include <gtest/gtest.h>
 
 using namespace isc::log;
 
@@ -37,8 +37,12 @@ TEST(MessageInitializerTest2, MessageLoadTest) {
         MessageInitializer initializer1(values);
     }
 
+    // Note: Not all systems have EXPECT_DEATH.  As it is a macro we can just
+    // test for its presence and bypass the test if not available.
+#ifdef EXPECT_DEATH
     // Adding one more should take us over the limit.
-    ASSERT_DEATH({
+    EXPECT_DEATH({
         MessageInitializer initializer2(values);
         }, ".*");
+#endif
 }