Parcourir la source

[trac555] Remove redundant test class from LoggerSpecification unit tests

... and correct error in previous commit.
Stephen Morris il y a 14 ans
Parent
commit
c58ee77ef6

+ 7 - 4
src/lib/log/tests/logger_manager_unittest.cc

@@ -186,6 +186,13 @@ TEST_F(LoggerManagerTest, FileLogger) {
     // Create a specification for the file logger and use the manager to
     // connect the "filelogger" logger to it.
     SpecificationForFileLogger file_spec;
+
+    // For the first test, we want to check that the file is created
+    // if it does not already exist.  So delete the temporary file before
+    // logging the first message.
+    unlink(file_spec.getFileName().c_str());
+
+    // Set up the file appenders.
     LoggerManager manager;
     manager.process(file_spec.getSpecification());
 
@@ -194,10 +201,6 @@ TEST_F(LoggerManagerTest, FileLogger) {
     // put in the file for a later comparison.
     vector<MessageID> ids;
     {
-        // For the first test, we want to check that the file is created
-        // if it does not already exist.  So delete the temporary file before
-        // logging the first message.
-        unlink(file_spec.getFileName());
 
         // Scope-limit the logger to ensure it is destroyed after the brief
         // check.  This adds weight to the idea that the logger will not

+ 4 - 14
src/lib/log/tests/logger_specification_unittest.cc

@@ -22,18 +22,8 @@
 using namespace isc::log;
 using namespace std;
 
-/// \brief LoggerSpecification Test
-class LoggerSpecificationTest : public ::testing::Test {
-public:
-    LoggerSpecificationTest()
-    {}
-    ~LoggerSpecificationTest()
-    {}
-};
-
-
 // Check default initialization.
-TEST_F(LoggerSpecificationTest, DefaultInitialization) {
+TEST(LoggerSpecificationTest, DefaultInitialization) {
     LoggerSpecification spec;
 
     EXPECT_EQ(string(""), spec.getName());
@@ -44,7 +34,7 @@ TEST_F(LoggerSpecificationTest, DefaultInitialization) {
 }
 
 // Non-default initialization
-TEST_F(LoggerSpecificationTest, Initialization) {
+TEST(LoggerSpecificationTest, Initialization) {
     LoggerSpecification spec("alpha", isc::log::ERROR, 42, true);
 
     EXPECT_EQ(string("alpha"), spec.getName());
@@ -55,7 +45,7 @@ TEST_F(LoggerSpecificationTest, Initialization) {
 }
 
 // Get/Set tests
-TEST_F(LoggerSpecificationTest, SetGet) {
+TEST(LoggerSpecificationTest, SetGet) {
     LoggerSpecification spec;
 
     spec.setName("gamma");
@@ -75,7 +65,7 @@ TEST_F(LoggerSpecificationTest, SetGet) {
 }
 
 // Check option setting
-TEST_F(LoggerSpecificationTest, AddOption) {
+TEST(LoggerSpecificationTest, AddOption) {
     OutputOption option1;
     option1.destination = OutputOption::DEST_FILE;
     option1.filename = "/tmp/example.log";