From 0c1aa2abc35933eb72161f9f29fc3ae2e2db2e67 Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Mon, 13 Feb 2017 12:41:08 -0500 Subject: [PATCH] Nicer, more compliant syntax in test --- tests/HelpersTest.cpp | 2 +- tests/IniTest.cpp | 4 ++-- tests/app_helper.hpp | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/HelpersTest.cpp b/tests/HelpersTest.cpp index 4b274956..b453f732 100644 --- a/tests/HelpersTest.cpp +++ b/tests/HelpersTest.cpp @@ -78,7 +78,7 @@ TEST(AppHelper, Ofstream) { TempFile myfile(name); { - std::ofstream out = myfile.ofstream(); + std::ofstream out{myfile}; out << "this is output" << std::endl; } diff --git a/tests/IniTest.cpp b/tests/IniTest.cpp index 52661dd4..29cacd0f 100644 --- a/tests/IniTest.cpp +++ b/tests/IniTest.cpp @@ -64,7 +64,7 @@ TEST_F(TApp, IniNotRequired) { app.add_config("--config", tmpini); { - std::ofstream out = tmpini.ofstream(); + std::ofstream out{tmpini}; out << "[default]" << std::endl; out << "two=99" << std::endl; out << "three=3" << std::endl; @@ -102,7 +102,7 @@ TEST_F(TApp, IniRequired) { app.add_config("--config", tmpini); { - std::ofstream out = tmpini.ofstream(); + std::ofstream out{tmpini}; out << "[default]" << std::endl; out << "two=99" << std::endl; out << "three=3" << std::endl; diff --git a/tests/app_helper.hpp b/tests/app_helper.hpp index 85b02aa6..363641b1 100644 --- a/tests/app_helper.hpp +++ b/tests/app_helper.hpp @@ -39,9 +39,6 @@ public: 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;} const char* c_str() const {return _name.c_str();} };