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:
parent
f071f91258
commit
0c1aa2abc3
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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();}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user