mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 05:52:23 +08:00
👷 gucc: replace all ofstream with helper function in tests
This commit is contained in:
parent
ce3da4affe
commit
3e09d7c065
@ -5,7 +5,6 @@
|
||||
#include "gucc/logger.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "gucc/logger.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ranges>
|
||||
#include <string_view>
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "doctest_compatibility.h"
|
||||
|
||||
#include "gucc/file_utils.hpp"
|
||||
#include "gucc/mtab.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string_view>
|
||||
|
||||
#include <fmt/core.h>
|
||||
@ -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());
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "gucc/package_profiles.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string_view>
|
||||
|
||||
#include <spdlog/sinks/callback_sink.h>
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "gucc/pacmanconf_repo.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "gucc/logger.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ranges>
|
||||
#include <string_view>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user