Lines Matching full:file
17 * Modify the specified file so that fs::remove() can successfully delete it.
21 * @param path path to the file
25 // makeFileUnRemovable() creates a directory at the file path. Remove the in makeFileRemovable()
29 // Rename the file back to the original path to restore its contents in makeFileRemovable()
35 * Modify the specified file so that fs::remove() fails with an exception.
37 * The file will be renamed and can be restored by calling makeFileRemovable().
39 * @param path path to the file
43 // Rename the file to save its contents in makeFileUnRemovable()
47 // Create a directory at the original file path in makeFileUnRemovable()
50 // Create a file within the directory. fs::remove() will throw an exception in makeFileUnRemovable()
60 // Create temporary file with some data in SetUp()
65 // Create temporary file with no data in SetUp()
79 // temporary file with Data
82 // temporary file with no data
118 // verify temporary file exists in TEST_F()
122 // Save path to temporary file in TEST_F()
126 TemporaryFile file{std::move(*tmpFile)}; in TEST_F() local
131 // Verify second object now owns same temporary file and file exists in TEST_F()
132 EXPECT_EQ(file.getPath(), path); in TEST_F()
133 EXPECT_TRUE(fs::exists(file.getPath())); in TEST_F()
135 // Delete file in TEST_F()
136 std::filesystem::remove_all(file.getPath()); in TEST_F()
142 // verify temporary file exists in TEST_F()
146 // Save path to first temporary file in TEST_F()
149 // Verify second temporary file exists in TEST_F()
153 // Save path to second temporary file in TEST_F()
165 // Verify second object now owns first temporary file and file exists in TEST_F()
169 // Verify second temporary file was deleted in TEST_F()
176 // Verify temporary file exists in TEST_F()
180 // Save path to temporary file in TEST_F()
186 // Verify object still owns same temporary file and file exists in TEST_F()
193 // Test where fails: Cannot delete temporary file in TEST_F()
194 // Verify temporary file exists in TEST_F()
198 // Save path to first temporary file in TEST_F()
201 // Verify temporary file exists in TEST_F()
205 // Save path to second temporary file in TEST_F()
211 // Make second temporary file unremoveable in TEST_F()
225 // Verify first object has not changed and first temporary file exists in TEST_F()
229 // Verify second object has not changed and second temporary file exists in TEST_F()
233 // Make second temporary file removeable so destructor can delete it in TEST_F()
239 // Test where works: Temporary file is not deleted in TEST_F()
243 TemporaryFile file("", 0); in TEST_F() local
244 path = file.getPath(); in TEST_F()
251 // Test where works: Temporary file was already deleted in TEST_F()
255 TemporaryFile file("", 0); in TEST_F() local
256 path = file.getPath(); in TEST_F()
258 file.remove(); in TEST_F()
264 // Test where fails: Cannot delete temporary file: No exception thrown in TEST_F()
269 TemporaryFile file("", 0); in TEST_F() local
270 path = file.getPath(); in TEST_F()
279 // Temporary file should still exist in TEST_F()
282 // Make file removable and delete it in TEST_F()
291 // Vverify temporary file exists in TEST_F()
295 // Save path to temporary file in TEST_F()
298 // Delete temporary file in TEST_F()
301 // Verify path is cleared and file does not exist in TEST_F()
305 // Delete temporary file again; should do nothing in TEST_F()
314 // Create TemporaryFile object and verify temporary file exists in TEST_F()
318 // Make file unremovable in TEST_F()
323 // Try to delete temporary file; should fail with exception in TEST_F()
332 // Make file removable again so it will be deleted by the destructor in TEST_F()