From e0192d29a4fbeb668eb2a35be0f46e2676c9d045 Mon Sep 17 00:00:00 2001 From: Gabriele Contini <contini.mailing@gmail.com> Date: 周日, 08 12月 2019 18:40:59 +0800 Subject: [PATCH] fix possible return value --- test/functional/generate-license.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/functional/generate-license.cpp b/test/functional/generate-license.cpp index febf621..3aa07f9 100644 --- a/test/functional/generate-license.cpp +++ b/test/functional/generate-license.cpp @@ -7,7 +7,9 @@ #include <boost/test/unit_test.hpp> #include <boost/filesystem.hpp> +#include <boost/algorithm/string.hpp> #include <sstream> +#include <fstream> #include <iostream> #include <licensecc_properties_test.h> @@ -27,8 +29,8 @@ if (!fs::exists(licenses_base)) { BOOST_REQUIRE_MESSAGE(fs::create_directories(licenses_base), "test folders created " + licenses_base.string()); } - - const fs::path license_fname(licenses_base / (license_name + ".lic")); + const string license_name_norm = boost::ends_with(license_name, ".lic") ? license_name : (license_name + ".lic"); + const fs::path license_fname(licenses_base / license_name_norm); const string license_fname_s = license_fname.string(); remove(license_fname_s.c_str()); @@ -75,7 +77,7 @@ const int retCode = std::system(ss.str().c_str()); BOOST_CHECK_EQUAL(retCode, 0); BOOST_ASSERT(fs::exists(outputFile)); - std::ifstream ifs(outputFile.c_str()); + std::ifstream ifs(output_file_s.c_str()); std::string content((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>())); return content; } -- Gitblit v1.9.1