#include #include #include #include #include #include #define CHECK_EC(ec) \ do \ { \ if (ec) \ { \ FAIL(ec.message()); \ } \ } while (0) namespace vcpkg::Test { std::unique_ptr make_control_file( const char* name, const char* depends, const std::vector>& features = {}, const std::vector& default_features = {}); inline auto test_parse_control_file(const std::vector>& v) { std::vector pghs; for (auto&& p : v) { pghs.emplace_back(); for (auto&& kv : p) pghs.back().emplace(kv.first, std::make_pair(kv.second, vcpkg::Parse::TextRowCol{})); } return vcpkg::SourceControlFile::parse_control_file("", std::move(pghs)); } std::unique_ptr make_status_pgh(const char* name, const char* depends = "", const char* default_features = "", const char* triplet = "x86-windows"); std::unique_ptr make_status_feature_pgh(const char* name, const char* feature, const char* depends = "", const char* triplet = "x86-windows"); /// /// Map of source control files by their package name. /// struct PackageSpecMap { std::unordered_map map; Triplet triplet; PackageSpecMap(Triplet t = Triplet::X86_WINDOWS) noexcept : triplet(t) { } PackageSpec emplace(const char* name, const char* depends = "", const std::vector>& features = {}, const std::vector& default_features = {}); PackageSpec emplace(vcpkg::SourceControlFileLocation&& scfl); }; template T&& unwrap(vcpkg::ExpectedT&& p) { REQUIRE(p.has_value()); return std::move(*p.get()); } template T&& unwrap(vcpkg::Optional&& opt) { REQUIRE(opt.has_value()); return std::move(*opt.get()); } struct AllowSymlinks { enum Tag : bool { No = false, Yes = true, } tag; constexpr AllowSymlinks(Tag tag) noexcept : tag(tag) { } constexpr explicit AllowSymlinks(bool b) noexcept : tag(b ? Yes : No) { } constexpr operator bool() const noexcept { return tag == Yes; } }; AllowSymlinks can_create_symlinks() noexcept; const fs::path& base_temporary_directory() noexcept; void create_symlink(const fs::path& file, const fs::path& target, std::error_code& ec); void create_directory_symlink(const fs::path& file, const fs::path& target, std::error_code& ec); }