1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-30 04:33:53 +00:00

Nicer, more compliant syntax in test

This commit is contained in:
Henry Fredrick Schreiner 2017-02-13 12:41:08 -05:00
parent f071f91258
commit 0c1aa2abc3
3 changed files with 3 additions and 6 deletions

View File

@ -78,7 +78,7 @@ TEST(AppHelper, Ofstream) {
TempFile myfile(name); TempFile myfile(name);
{ {
std::ofstream out = myfile.ofstream(); std::ofstream out{myfile};
out << "this is output" << std::endl; out << "this is output" << std::endl;
} }

View File

@ -64,7 +64,7 @@ TEST_F(TApp, IniNotRequired) {
app.add_config("--config", tmpini); app.add_config("--config", tmpini);
{ {
std::ofstream out = tmpini.ofstream(); std::ofstream out{tmpini};
out << "[default]" << std::endl; out << "[default]" << std::endl;
out << "two=99" << std::endl; out << "two=99" << std::endl;
out << "three=3" << std::endl; out << "three=3" << std::endl;
@ -102,7 +102,7 @@ TEST_F(TApp, IniRequired) {
app.add_config("--config", tmpini); app.add_config("--config", tmpini);
{ {
std::ofstream out = tmpini.ofstream(); std::ofstream out{tmpini};
out << "[default]" << std::endl; out << "[default]" << std::endl;
out << "two=99" << std::endl; out << "two=99" << std::endl;
out << "three=3" << std::endl; out << "three=3" << std::endl;

View File

@ -39,9 +39,6 @@ public:
std::remove(_name.c_str()); // Doesn't matter if returns 0 or not std::remove(_name.c_str()); // Doesn't matter if returns 0 or not
} }
/// Returns by move in C++11
std::ofstream ofstream() const {return std::ofstream(_name);}
operator const std::string& () const {return _name;} operator const std::string& () const {return _name;}
const char* c_str() const {return _name.c_str();} const char* c_str() const {return _name.c_str();}
}; };