aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg-test/downloads.cpp
diff options
context:
space:
mode:
authorras0219 <533828+ras0219@users.noreply.github.com>2020-11-18 12:21:23 -0800
committerGitHub <noreply@github.com>2020-11-18 12:21:23 -0800
commit5c48bee4519267e565d5cc550a8618a91f47961d (patch)
tree4e075a04e20117913f8949f443ab706ecf36db6b /toolsrc/src/vcpkg-test/downloads.cpp
parent2018406edbe323bcf13a19cc131a08bc3eca18d9 (diff)
downloadvcpkg-5c48bee4519267e565d5cc550a8618a91f47961d.tar.gz
vcpkg-5c48bee4519267e565d5cc550a8618a91f47961d.zip
[vcpkg] Add experimental x-azblob binary provider (#13626)
* [vcpkg] Add experimental x-azblob binary provider * [vcpkg] Test azblob storage provider in CI * [vcpkg] Address some CR comments from #13639 * [vcpkg] Fixup azure-pipelines * [vcpkg] Fix regression where the downloaded package is purged before decompressing * [vcpkg] Further refactor vcpkg::Downloads * [vcpkg] Enable OSX for x-azblob testing * [vcpkg] Reduce diff against master * [vcpkg] Extract Downloads::details::split_uri_view * [vcpkg] Address PR comments * [vcpkg] Add testing and metrics for x-azblob * [vcpkg] Add docs for x-azblob This includes a note that it is currently experimental * [vcpkg] Address CR comments * [vcpkg] Revert pipeline changes except OSX to minimize disruption Co-authored-by: Robert Schumacher <roschuma@microsoft.com> Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Diffstat (limited to 'toolsrc/src/vcpkg-test/downloads.cpp')
-rw-r--r--toolsrc/src/vcpkg-test/downloads.cpp59
1 files changed, 59 insertions, 0 deletions
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 == "/");
+ }
+}