mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
e5b92a3911
* [vcpkg] Modify Filesystem::remove and Filesystem::rename to not throw. * [.gitignore] Ignore new VS2019 CMake integration default location * [.gitignore] Ignore CMakeSettings.json in toolsrc * [vcpkg] Time external processes called with System::cmd_execute * [vcpkg] Work around VS2019 CMake bug * [vcpkg] Fix several unused variable warnings. * [vcpkg] Improve error handling in vcpkg::Files::Filesystem Always require either std::error_code or LineInfo to print better errors. * [vcpkg] Fixup missing return value. Drive by fix: silence warnings in tests. * [vcpkg] Fix exiting in error_code overload Drive by fixes for /analyze with VS2019
77 lines
2.7 KiB
C++
77 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include <CppUnitTest.h>
|
|
|
|
#include <vcpkg/dependencies.h>
|
|
#include <vcpkg/packagespec.h>
|
|
#include <vcpkg/packagespecparseresult.h>
|
|
#include <vcpkg/statusparagraph.h>
|
|
#include <vcpkg/triplet.h>
|
|
|
|
#include <memory>
|
|
|
|
namespace Microsoft::VisualStudio::CppUnitTestFramework
|
|
{
|
|
template<>
|
|
inline std::wstring ToString<vcpkg::Dependencies::InstallPlanType>(const vcpkg::Dependencies::InstallPlanType& t)
|
|
{
|
|
switch (t)
|
|
{
|
|
case vcpkg::Dependencies::InstallPlanType::ALREADY_INSTALLED: return L"ALREADY_INSTALLED";
|
|
case vcpkg::Dependencies::InstallPlanType::BUILD_AND_INSTALL: return L"BUILD_AND_INSTALL";
|
|
case vcpkg::Dependencies::InstallPlanType::EXCLUDED: return L"EXCLUDED";
|
|
case vcpkg::Dependencies::InstallPlanType::UNKNOWN: return L"UNKNOWN";
|
|
default: return ToString(static_cast<int>(t));
|
|
}
|
|
}
|
|
|
|
template<>
|
|
inline std::wstring ToString<vcpkg::Dependencies::RequestType>(const vcpkg::Dependencies::RequestType& t)
|
|
{
|
|
switch (t)
|
|
{
|
|
case vcpkg::Dependencies::RequestType::AUTO_SELECTED: return L"AUTO_SELECTED";
|
|
case vcpkg::Dependencies::RequestType::USER_REQUESTED: return L"USER_REQUESTED";
|
|
case vcpkg::Dependencies::RequestType::UNKNOWN: return L"UNKNOWN";
|
|
default: return ToString(static_cast<int>(t));
|
|
}
|
|
}
|
|
|
|
template<>
|
|
inline std::wstring ToString<vcpkg::PackageSpecParseResult>(const vcpkg::PackageSpecParseResult& t)
|
|
{
|
|
return ToString(static_cast<uint32_t>(t));
|
|
}
|
|
|
|
template<>
|
|
inline std::wstring ToString<vcpkg::PackageSpec>(const vcpkg::PackageSpec& t)
|
|
{
|
|
return ToString(t.to_string());
|
|
}
|
|
}
|
|
|
|
std::unique_ptr<vcpkg::StatusParagraph> make_status_pgh(const char* name,
|
|
const char* depends = "",
|
|
const char* default_features = "",
|
|
const char* triplet = "x86-windows");
|
|
std::unique_ptr<vcpkg::StatusParagraph> make_status_feature_pgh(const char* name,
|
|
const char* feature,
|
|
const char* depends = "",
|
|
const char* triplet = "x86-windows");
|
|
|
|
template<class T, class S>
|
|
T&& unwrap(vcpkg::ExpectedT<T, S>&& p)
|
|
{
|
|
Assert::IsTrue(p.has_value());
|
|
return std::move(*p.get());
|
|
}
|
|
|
|
template<class T>
|
|
T&& unwrap(vcpkg::Optional<T>&& opt)
|
|
{
|
|
Assert::IsTrue(opt.has_value());
|
|
return std::move(*opt.get());
|
|
}
|
|
|
|
vcpkg::PackageSpec unsafe_pspec(std::string name, vcpkg::Triplet t = vcpkg::Triplet::X86_WINDOWS);
|