]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3932] Changed removeFile() to return a status one can check
authorFrancis Dupont <fdupont@isc.org>
Wed, 8 Jul 2015 13:25:35 +0000 (15:25 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 8 Jul 2015 13:25:35 +0000 (15:25 +0200)
src/lib/util/tests/csv_file_unittest.cc

index 1facd1ef22378f68f0e8dfd5ad8ec6ac5585dc1f..823d4dab4ced441e8a75f781327ee76e51b646fe 100644 (file)
@@ -148,7 +148,7 @@ public:
     std::string readFile() const;
 
     /// @brief Removes existing file (if any).
-    void removeFile() const;
+    int removeFile() const;
 
     /// @brief Creates file with contents.
     ///
@@ -162,11 +162,11 @@ public:
 
 CSVFileTest::CSVFileTest()
     : testfile_(absolutePath("test.csv")) {
-    removeFile();
+    static_cast<void>(removeFile());
 }
 
 CSVFileTest::~CSVFileTest() {
-    removeFile();
+    static_cast<void>(removeFile());
 }
 
 std::string
@@ -196,9 +196,9 @@ CSVFileTest::readFile() const {
     return (contents);
 }
 
-void
+int
 CSVFileTest::removeFile() const {
-    remove(testfile_.c_str());
+    return (remove(testfile_.c_str()));
 }
 
 void
@@ -496,7 +496,7 @@ TEST_F(CSVFileTest, exists) {
 
     // Close the file and remove it.
     csv->close();
-    removeFile();
+    EXPECT_EQ(0, removeFile());
 
     // The file should not exist.
     EXPECT_FALSE(csv->exists());