mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-02-02 22:07:13 +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 "gucc/logger.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "gucc/logger.hpp"
|
#include "gucc/logger.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "doctest_compatibility.h"
|
#include "doctest_compatibility.h"
|
||||||
|
|
||||||
|
#include "gucc/file_utils.hpp"
|
||||||
#include "gucc/mtab.hpp"
|
#include "gucc/mtab.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
@ -121,13 +121,7 @@ TEST_CASE("mtab test")
|
|||||||
SECTION("live iso system")
|
SECTION("live iso system")
|
||||||
{
|
{
|
||||||
static constexpr std::string_view filename{"/tmp/mtab.conf"};
|
static constexpr std::string_view filename{"/tmp/mtab.conf"};
|
||||||
// Open mtab file for writing.
|
REQUIRE(file_utils::create_file_for_overwrite(filename, MTAB_LIVE_ISO_TEST));
|
||||||
std::ofstream mtab_file{filename.data()};
|
|
||||||
REQUIRE(mtab_file.is_open());
|
|
||||||
|
|
||||||
// Setup mtab file.
|
|
||||||
mtab_file << MTAB_LIVE_ISO_TEST;
|
|
||||||
mtab_file.close();
|
|
||||||
|
|
||||||
const auto& mtab_entries = gucc::mtab::parse_mtab("/tmp/calamares-root-q_z5rdlx"sv, filename);
|
const auto& mtab_entries = gucc::mtab::parse_mtab("/tmp/calamares-root-q_z5rdlx"sv, filename);
|
||||||
REQUIRE(mtab_entries.has_value());
|
REQUIRE(mtab_entries.has_value());
|
||||||
@ -170,13 +164,7 @@ TEST_CASE("mtab test")
|
|||||||
SECTION("empty file")
|
SECTION("empty file")
|
||||||
{
|
{
|
||||||
static constexpr std::string_view filename{"/tmp/mtab.conf"};
|
static constexpr std::string_view filename{"/tmp/mtab.conf"};
|
||||||
// Open mtab file for writing.
|
REQUIRE(file_utils::create_file_for_overwrite(filename, ""));
|
||||||
std::ofstream mtab_file{filename.data()};
|
|
||||||
REQUIRE(mtab_file.is_open());
|
|
||||||
|
|
||||||
// Setup mtab file.
|
|
||||||
mtab_file << "";
|
|
||||||
mtab_file.close();
|
|
||||||
|
|
||||||
const auto& mtab_entries = gucc::mtab::parse_mtab("/tmp/calamares-root-q_z5rdlx"sv, filename);
|
const auto& mtab_entries = gucc::mtab::parse_mtab("/tmp/calamares-root-q_z5rdlx"sv, filename);
|
||||||
REQUIRE(!mtab_entries.has_value());
|
REQUIRE(!mtab_entries.has_value());
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "gucc/package_profiles.hpp"
|
#include "gucc/package_profiles.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#include <spdlog/sinks/callback_sink.h>
|
#include <spdlog/sinks/callback_sink.h>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "gucc/pacmanconf_repo.hpp"
|
#include "gucc/pacmanconf_repo.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "gucc/logger.hpp"
|
#include "gucc/logger.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user