From a96092ac32217b4b0ded287d29136d20833f4594 Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 3 Apr 2016 01:25:41 +0300 Subject: [PATCH] tests small update --- tests/file_helper.cpp | 20 ++++++++++---------- tests/utils.cpp | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/file_helper.cpp b/tests/file_helper.cpp index f57ab707..5f3574d0 100644 --- a/tests/file_helper.cpp +++ b/tests/file_helper.cpp @@ -5,7 +5,7 @@ using namespace spdlog::details; -static const std::string filename = "logs/file_helper_test.txt"; +static const std::string target_filename = "logs/file_helper_test.txt"; static void write_with_helper(file_helper &helper, size_t howmany) { @@ -20,8 +20,8 @@ TEST_CASE("file_helper_filename", "[file_helper::filename()]]") prepare_logdir(); file_helper helper(false); - helper.open(filename); - REQUIRE(helper.filename() == filename); + helper.open(target_filename); + REQUIRE(helper.filename() == target_filename); } @@ -32,28 +32,28 @@ TEST_CASE("file_helper_size", "[file_helper::size()]]") auto expected_size = 123; { file_helper helper(true); - helper.open(filename); + helper.open(target_filename); write_with_helper(helper, expected_size); REQUIRE(helper.size() == expected_size); } - REQUIRE(get_filesize(filename) == expected_size); + REQUIRE(get_filesize(target_filename) == expected_size); } TEST_CASE("file_helper_exists", "[file_helper::file_exists()]]") { prepare_logdir(); - REQUIRE(!file_helper::file_exists(filename)); + REQUIRE(!file_helper::file_exists(target_filename)); file_helper helper(false); - helper.open(filename); - REQUIRE(file_helper::file_exists(filename)); + helper.open(target_filename); + REQUIRE(file_helper::file_exists(target_filename)); } TEST_CASE("file_helper_reopen", "[file_helper::reopen()]]") { prepare_logdir(); file_helper helper(true); - helper.open(filename); + helper.open(target_filename); write_with_helper(helper, 12); REQUIRE(helper.size() == 12); helper.reopen(true); @@ -65,7 +65,7 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]") prepare_logdir(); auto expected_size = 14; file_helper helper(true); - helper.open(filename); + helper.open(target_filename); write_with_helper(helper, expected_size); REQUIRE(helper.size() == expected_size); helper.reopen(false); diff --git a/tests/utils.cpp b/tests/utils.cpp index 83fdf84f..751ff820 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -4,10 +4,11 @@ void prepare_logdir() { spdlog::drop_all(); #ifdef _WIN32 - system("del /F /Q logs\\*"); + auto rv = system("del /F /Q logs\\*"); #else - system("rm -f logs/*"); + auto rv = system("rm -f logs/*"); #endif + (void)rv; } @@ -42,4 +43,3 @@ std::size_t get_filesize(const std::string& filename) return ifs.tellg(); } -