aboutsummaryrefslogtreecommitdiff
path: root/tests/repository-location
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-04-18 12:35:37 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2018-04-19 12:12:52 +0300
commit7cf0854121525747b438b7f94bf2d050f61fb615 (patch)
treebb68ea236c590f71247bf9652991657e25db2524 /tests/repository-location
parentf8bee7e57187ae9bd55a95bcac4fa07e41ff4dfb (diff)
Implement git repository handling transition (phase 0)
Diffstat (limited to 'tests/repository-location')
-rw-r--r--tests/repository-location/driver.cxx42
1 files changed, 26 insertions, 16 deletions
diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx
index 014b810..2e39c26 100644
--- a/tests/repository-location/driver.cxx
+++ b/tests/repository-location/driver.cxx
@@ -154,17 +154,8 @@ namespace bpkg
assert (bad_loc ("c:\\aaa\\bbb"));
#endif
- // Invalid/absent URL fragment.
+ // Invalid URL fragment.
//
-#ifndef _WIN32
- assert (bad_loc ("file://localhost/", repository_type::git));
-#else
- assert (bad_loc ("file://localhost/c:/", repository_type::git));
-#endif
-
- assert (bad_loc ("https://www.example.com/test.git",
- repository_type::git));
-
assert (bad_loc ("https://www.example.com/test.git#",
repository_type::git));
@@ -320,6 +311,11 @@ namespace bpkg
assert (l.canonical_name () == "git:/git/repo#branch");
}
{
+ repository_location l (loc ("file://localhost/", repository_type::git));
+ assert (l.string () == "/");
+ assert (l.canonical_name () == "git:/");
+ }
+ {
repository_location l (loc ("file://localhost/#master",
repository_type::git));
assert (l.string () == "file:/#master");
@@ -392,6 +388,12 @@ namespace bpkg
assert (l.canonical_name () == "git:c:\\git\\repo#branch");
}
{
+ repository_location l (loc ("file://localhost/c:/",
+ repository_type::git));
+ assert (l.string () == "c:");
+ assert (l.canonical_name () == "git:c:");
+ }
+ {
repository_location l (loc ("file://localhost/c:/#master",
repository_type::git));
assert (l.string () == "file:/c:#master");
@@ -451,6 +453,14 @@ namespace bpkg
assert (l.type () == repository_type::pkg);
}
{
+ repository_location l (loc ("https://www.example.com/test.git",
+ repository_type::git));
+ assert (l.string () == "https://www.example.com/test.git");
+ assert (l.canonical_name () == "git:example.com/test");
+ assert (l.proto () == proto::https);
+ assert (l.type () == repository_type::git);
+ }
+ {
repository_location l (loc ("git://example.com/test#master",
repository_type::git));
assert (l.string () == "git://example.com/test#master");
@@ -805,13 +815,13 @@ namespace bpkg
string branch ("master");
string commit ("0a53e9ddeaddad63ad106860237bbf53411d11a7");
- assert (*git_reference (branch).branch == branch);
- assert (*git_reference (commit + "@").branch == commit);
- assert (*git_reference (commit).commit == commit);
- assert (*git_reference ("@" + commit).commit == commit);
+ assert (*git_ref_filter (branch).name == branch);
+ assert (*git_ref_filter (commit + "@").name == commit);
+ assert (*git_ref_filter (commit).commit == commit);
+ assert (*git_ref_filter ("@" + commit).commit == commit);
- git_reference r (branch + "@" + commit);
- assert (*r.branch == branch && *r.commit == commit);
+ git_ref_filter r (branch + "@" + commit);
+ assert (*r.name == branch && *r.commit == commit);
}
// repository_url