diff --git a/gucc/tests/unit-initcpio.cpp b/gucc/tests/unit-initcpio.cpp index 35cbff6..e4515bd 100644 --- a/gucc/tests/unit-initcpio.cpp +++ b/gucc/tests/unit-initcpio.cpp @@ -5,7 +5,6 @@ #include "gucc/logger.hpp" #include -#include #include #include #include diff --git a/gucc/tests/unit-locale.cpp b/gucc/tests/unit-locale.cpp index 642c158..2399a33 100644 --- a/gucc/tests/unit-locale.cpp +++ b/gucc/tests/unit-locale.cpp @@ -5,7 +5,6 @@ #include "gucc/logger.hpp" #include -#include #include #include diff --git a/gucc/tests/unit-mtab.cpp b/gucc/tests/unit-mtab.cpp index 1d1bc93..13d89e1 100644 --- a/gucc/tests/unit-mtab.cpp +++ b/gucc/tests/unit-mtab.cpp @@ -1,9 +1,9 @@ #include "doctest_compatibility.h" +#include "gucc/file_utils.hpp" #include "gucc/mtab.hpp" #include -#include #include #include @@ -121,13 +121,7 @@ TEST_CASE("mtab test") SECTION("live iso system") { static constexpr std::string_view filename{"/tmp/mtab.conf"}; - // Open mtab file for writing. - std::ofstream mtab_file{filename.data()}; - REQUIRE(mtab_file.is_open()); - - // Setup mtab file. - mtab_file << MTAB_LIVE_ISO_TEST; - mtab_file.close(); + REQUIRE(file_utils::create_file_for_overwrite(filename, MTAB_LIVE_ISO_TEST)); const auto& mtab_entries = gucc::mtab::parse_mtab("/tmp/calamares-root-q_z5rdlx"sv, filename); REQUIRE(mtab_entries.has_value()); @@ -170,13 +164,7 @@ TEST_CASE("mtab test") SECTION("empty file") { static constexpr std::string_view filename{"/tmp/mtab.conf"}; - // Open mtab file for writing. - std::ofstream mtab_file{filename.data()}; - REQUIRE(mtab_file.is_open()); - - // Setup mtab file. - mtab_file << ""; - mtab_file.close(); + REQUIRE(file_utils::create_file_for_overwrite(filename, "")); const auto& mtab_entries = gucc::mtab::parse_mtab("/tmp/calamares-root-q_z5rdlx"sv, filename); REQUIRE(!mtab_entries.has_value()); diff --git a/gucc/tests/unit-package_profiles.cpp b/gucc/tests/unit-package_profiles.cpp index 591d560..4d7e008 100644 --- a/gucc/tests/unit-package_profiles.cpp +++ b/gucc/tests/unit-package_profiles.cpp @@ -5,7 +5,6 @@ #include "gucc/package_profiles.hpp" #include -#include #include #include diff --git a/gucc/tests/unit-pacmanconf.cpp b/gucc/tests/unit-pacmanconf.cpp index 26ad6f5..af943f0 100644 --- a/gucc/tests/unit-pacmanconf.cpp +++ b/gucc/tests/unit-pacmanconf.cpp @@ -4,7 +4,6 @@ #include "gucc/pacmanconf_repo.hpp" #include -#include #include #include #include diff --git a/gucc/tests/unit-refind_extra_kern_strings.cpp b/gucc/tests/unit-refind_extra_kern_strings.cpp index ff57ced..390210b 100644 --- a/gucc/tests/unit-refind_extra_kern_strings.cpp +++ b/gucc/tests/unit-refind_extra_kern_strings.cpp @@ -5,7 +5,6 @@ #include "gucc/logger.hpp" #include -#include #include #include