aboutsummaryrefslogtreecommitdiff
path: root/tests/repository-location
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-02-14 19:27:47 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-15 11:08:22 +0300
commit18e40e91c99088ef5fb9458ec4c1ec21ddcc51e6 (patch)
treebbb91a98a375e9cae387f03a7ca1ef32db202d73 /tests/repository-location
parent02458785b93094dfc65b31a4ecf2a8e690143b03 (diff)
Add support for git manifests
Diffstat (limited to 'tests/repository-location')
-rw-r--r--tests/repository-location/driver.cxx44
1 files changed, 39 insertions, 5 deletions
diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx
index ad3b0dd..e4282fe 100644
--- a/tests/repository-location/driver.cxx
+++ b/tests/repository-location/driver.cxx
@@ -33,9 +33,11 @@ namespace bpkg
}
inline static repository_location
- loc (const string& l, const repository_location& b)
+ loc (const string& l,
+ const repository_location& b,
+ repository_type t = repository_type::bpkg)
{
- return repository_location (repository_url (l), b);
+ return repository_location (repository_url (l), t, b);
}
inline static bool
@@ -53,11 +55,13 @@ namespace bpkg
}
inline static bool
- bad_loc (const string& l, const repository_location& b)
+ bad_loc (const string& l,
+ const repository_location& b,
+ repository_type t = repository_type::bpkg)
{
try
{
- repository_location bl (repository_url (l), b);
+ repository_location bl (repository_url (l), t, b);
return false;
}
catch (const invalid_argument&)
@@ -71,7 +75,7 @@ namespace bpkg
{
istringstream is (":1\nurl: " + l);
manifest_parser mp (is, "");
- repository_manifest m (mp);
+ repository_manifest m (bpkg_repository_manifest (mp));
optional<string> u (m.effective_url (r));
assert (u);
@@ -307,6 +311,11 @@ namespace bpkg
assert (l.canonical_name () == "git:/git/repo");
}
{
+ repository_location l (loc ("/git/repo#branch", repository_type::git));
+ assert (l.string () == "file:/git/repo#branch");
+ assert (l.canonical_name () == "git:/git/repo");
+ }
+ {
repository_location l (loc ("file://localhost/#master",
repository_type::git));
assert (l.string () == "file:/#master");
@@ -368,6 +377,12 @@ namespace bpkg
assert (l.canonical_name () == "git:c:\\git\\repo");
}
{
+ repository_location l (loc ("c:\\git\\repo#branch",
+ repository_type::git));
+ assert (l.string () == "file:/c:/git/repo#branch");
+ assert (l.canonical_name () == "git:c:\\git\\repo");
+ }
+ {
repository_location l (loc ("file://localhost/c:/#master",
repository_type::git));
assert (l.string () == "file:/c:#master");
@@ -435,6 +450,7 @@ namespace bpkg
assert (l.string () == "http://example.com/test.git#master");
assert (l.canonical_name () == "git:example.com/test");
assert (l.proto () == proto::http);
+ assert (l.type () == repository_type::git);
}
{
repository_location l (loc ("https://example.com/test.git#master",
@@ -576,6 +592,24 @@ namespace bpkg
assert (l2.canonical_name () == "bpkg:stable.cppget.org:444/math");
assert (l2.proto () == proto::https);
}
+ {
+ repository_location l (loc ("../test.git#master",
+ repository_location (),
+ repository_type::git));
+ assert (l.string () == "../test.git#master");
+ assert (l.canonical_name ().empty ());
+ assert (l.proto () == proto::file);
+ }
+ {
+ repository_location l1 (loc ("https://example.com/stable.git#stable",
+ repository_type::git));
+ repository_location l2 (loc ("../test.git#master",
+ l1,
+ repository_type::git));
+ assert (l2.string () == "https://example.com/test.git#master");
+ assert (l2.canonical_name () == "git:example.com/test");
+ assert (l2.proto () == proto::https);
+ }
#ifndef _WIN32
{
repository_location l1 (loc ("/var/r1/1/misc"));