| 42 | { |
| 43 | protected: |
| 44 | Try<Nothing> createTestFile( |
| 45 | const Path& file, |
| 46 | const Option<Path>& directory = None()) |
| 47 | { |
| 48 | const Path testFile( |
| 49 | directory.isSome() ? |
| 50 | path::join(directory.get(), file.string()): file); |
| 51 | |
| 52 | const string& testFileDir = testFile.dirname(); |
| 53 | if (!os::exists(testFileDir)) { |
| 54 | Try<Nothing> mkdir = os::mkdir(testFileDir, true); |
| 55 | if (mkdir.isError()) { |
| 56 | return Error("Failed to create test directory: " + mkdir.error()); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | Try<Nothing> write = os::write(testFile, "test"); |
| 61 | if (write.isError()) { |
| 62 | return Error("Failed to create to test file: " + write.error()); |
| 63 | } |
| 64 | |
| 65 | return Nothing(); |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 |
nothing calls this directly
no test coverage detected