mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-02 21:29:00 +08:00
300e21d59e
- Add the "VCPKG_DEVELOPMENT_WARNINGS" flag - setting "WERROR" will also set this flag - This flag is set by default - on GCC/clang, this will pass '-Wall -Wextra -Wpedantic -Werror' - on GCC, this will additionally pass '-Wmissing-declarations' - on clang, this will additionally pass '-Wmissing-prototypes' - on MSVC, this will pass '-W4 -WX' - On Visual Studio 2017 and later, pass '-permissive-' - Change the source for fallout of these changes - add `format` subcommand - formats all C++ source and header files using clang-format - move `include/vcpkg-test/catch.h` to `include/catch2/catch.hpp` - pass CONFIGURE_DEPENDS to file(GLOB)
69 lines
2.8 KiB
C++
69 lines
2.8 KiB
C++
#include <catch2/catch.hpp>
|
|
#include <vcpkg/pragmas.h>
|
|
|
|
#include <vcpkg/base/files.h>
|
|
#include <vcpkg/statusparagraph.h>
|
|
|
|
#include <memory>
|
|
|
|
#define CHECK_EC(ec) \
|
|
do \
|
|
{ \
|
|
if (ec) \
|
|
{ \
|
|
FAIL(ec.message()); \
|
|
} \
|
|
} while (0)
|
|
|
|
namespace vcpkg::Test
|
|
{
|
|
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");
|
|
|
|
vcpkg::PackageSpec unsafe_pspec(std::string name, vcpkg::Triplet t = vcpkg::Triplet::X86_WINDOWS);
|
|
|
|
template<class T, class S>
|
|
T&& unwrap(vcpkg::ExpectedT<T, S>&& p)
|
|
{
|
|
REQUIRE(p.has_value());
|
|
return std::move(*p.get());
|
|
}
|
|
|
|
template<class T>
|
|
T&& unwrap(vcpkg::Optional<T>&& 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);
|
|
}
|