diff options
Diffstat (limited to 'toolsrc/src/vcpkg-test')
| -rw-r--r-- | toolsrc/src/vcpkg-test/binaryconfigparser.cpp | 36 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg-test/downloads.cpp | 59 |
2 files changed, 95 insertions, 0 deletions
diff --git a/toolsrc/src/vcpkg-test/binaryconfigparser.cpp b/toolsrc/src/vcpkg-test/binaryconfigparser.cpp index 259f1986e..1c46790bf 100644 --- a/toolsrc/src/vcpkg-test/binaryconfigparser.cpp +++ b/toolsrc/src/vcpkg-test/binaryconfigparser.cpp @@ -298,3 +298,39 @@ TEST_CASE ("BinaryConfigParser args", "[binaryconfigparser]") REQUIRE(parsed.has_value()); } } + +TEST_CASE ("BinaryConfigParser azblob provider", "[binaryconfigparser]") +{ + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,https://azure/container,sas", {}); + REQUIRE(parsed.has_value()); + } + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,https://azure/container,?sas", {}); + REQUIRE(!parsed.has_value()); + } + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,,sas", {}); + REQUIRE(!parsed.has_value()); + } + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,https://azure/container", {}); + REQUIRE(!parsed.has_value()); + } + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,https://azure/container,sas,invalid", {}); + REQUIRE(!parsed.has_value()); + } + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,https://azure/container,sas,read", {}); + REQUIRE(parsed.has_value()); + } + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,https://azure/container,sas,write", {}); + REQUIRE(parsed.has_value()); + } + { + auto parsed = create_binary_provider_from_configs_pure("x-azblob,https://azure/container,sas,readwrite", {}); + REQUIRE(parsed.has_value()); + } +} diff --git a/toolsrc/src/vcpkg-test/downloads.cpp b/toolsrc/src/vcpkg-test/downloads.cpp new file mode 100644 index 000000000..b182e46d6 --- /dev/null +++ b/toolsrc/src/vcpkg-test/downloads.cpp @@ -0,0 +1,59 @@ +#include <catch2/catch.hpp> + +#include <vcpkg/base/downloads.h> + +using namespace vcpkg; + +TEST_CASE ("Downloads::details::split_uri_view", "[downloads]") +{ + { + auto x = Downloads::details::split_uri_view("https://github.com/Microsoft/vcpkg"); + REQUIRE(x.has_value()); + REQUIRE(x.get()->scheme == "https"); + REQUIRE(x.get()->authority.value_or("") == "//github.com"); + REQUIRE(x.get()->path_query_fragment == "/Microsoft/vcpkg"); + } + { + auto x = Downloads::details::split_uri_view(""); + REQUIRE(!x.has_value()); + } + { + auto x = Downloads::details::split_uri_view("hello"); + REQUIRE(!x.has_value()); + } + { + auto x = Downloads::details::split_uri_view("file:"); + REQUIRE(x.has_value()); + REQUIRE(x.get()->scheme == "file"); + REQUIRE(!x.get()->authority.has_value()); + REQUIRE(x.get()->path_query_fragment == ""); + } + { + auto x = Downloads::details::split_uri_view("file:path"); + REQUIRE(x.has_value()); + REQUIRE(x.get()->scheme == "file"); + REQUIRE(!x.get()->authority.has_value()); + REQUIRE(x.get()->path_query_fragment == "path"); + } + { + auto x = Downloads::details::split_uri_view("file:/path"); + REQUIRE(x.has_value()); + REQUIRE(x.get()->scheme == "file"); + REQUIRE(!x.get()->authority.has_value()); + REQUIRE(x.get()->path_query_fragment == "/path"); + } + { + auto x = Downloads::details::split_uri_view("file://user:pw@host"); + REQUIRE(x.has_value()); + REQUIRE(x.get()->scheme == "file"); + REQUIRE(x.get()->authority.value_or({}) == "//user:pw@host"); + REQUIRE(x.get()->path_query_fragment == ""); + } + { + auto x = Downloads::details::split_uri_view("ftp://host:port/"); + REQUIRE(x.has_value()); + REQUIRE(x.get()->scheme == "ftp"); + REQUIRE(x.get()->authority.value_or({}) == "//host:port"); + REQUIRE(x.get()->path_query_fragment == "/"); + } +} |
