|
Ninja
|
A class that records a file path and ensures that it is removed on destruction. More...
#include <test.h>
Public Member Functions | |
| const char * | c_str () const |
| ScopedFilePath & | operator= (ScopedFilePath &&) noexcept |
| It would be nice to use '= default' here instead but some old compilers such as GCC from Ubuntu 16.06 will not compile it with "noexcept", so just write it manually. More... | |
| const std::string & | path () const |
| void | Release () |
| Release the file, the destructor will not remove the file. More... | |
| bool | released () const |
| ScopedFilePath (const char *path) | |
| ScopedFilePath (const std::string &path) | |
| Constructor just records the file path. More... | |
| ScopedFilePath (ScopedFilePath &&) noexcept | |
| Allow move operations. More... | |
| ~ScopedFilePath () | |
| Destructor destroys the file, unless Release() was called. More... | |
Private Attributes | |
| std::string | path_ |
| bool | released_ = false |
A class that records a file path and ensures that it is removed on destruction.
This ensures that tests do not keep stale files in the current directory where they run, even in case of assertion failure.
|
inline |
|
noexcept |
| ScopedFilePath::~ScopedFilePath | ( | ) |
Destructor destroys the file, unless Release() was called.
Definition at line 256 of file test.cc.
References platformAwareUnlink().
|
inline |
|
noexcept |
|
inline |
| void ScopedFilePath::Release | ( | ) |
|
inline |
|
private |
|
private |
Definition at line 127 of file test.h.
Referenced by released().