| 334 | } |
| 335 | |
| 336 | void SC::FileSystemTest::renameFile() |
| 337 | { |
| 338 | //! [renameFileSnippet] |
| 339 | FileSystem fs; |
| 340 | SC_TEST_EXPECT(fs.init(report.applicationRootDirectory.view())); |
| 341 | |
| 342 | // Create a file and check that it exists |
| 343 | SC_TEST_EXPECT(fs.writeString("renameTest.txt", "asdf")); |
| 344 | SC_TEST_EXPECT(fs.existsAndIsFile("renameTest.txt")); |
| 345 | |
| 346 | // Rename the file |
| 347 | SC_TEST_EXPECT(fs.rename("renameTest.txt", "renameTest2.txt")); |
| 348 | |
| 349 | // Check that the file has been renamed |
| 350 | SC_TEST_EXPECT(fs.existsAndIsFile("renameTest2.txt")); |
| 351 | SC_TEST_EXPECT(not fs.existsAndIsFile("renameTest.txt")); |
| 352 | |
| 353 | // Rename the file again |
| 354 | SC_TEST_EXPECT(fs.rename("renameTest2.txt", "renameTest.txt")); |
| 355 | |
| 356 | // Check that the file has been renamed |
| 357 | SC_TEST_EXPECT(fs.existsAndIsFile("renameTest.txt")); |
| 358 | SC_TEST_EXPECT(not fs.existsAndIsFile("renameTest2.txt")); |
| 359 | |
| 360 | // Remove all files created by the test |
| 361 | SC_TEST_EXPECT(fs.removeFile("renameTest.txt")); |
| 362 | //! [renameFileSnippet] |
| 363 | } |
| 364 | |
| 365 | void SC::FileSystemTest::renameDirectory() |
| 366 | { |
nothing calls this directly
no test coverage detected