From 7cf0854121525747b438b7f94bf2d050f61fb615 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Apr 2018 12:35:37 +0200 Subject: Implement git repository handling transition (phase 0) --- tests/repository-location/driver.cxx | 42 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'tests/repository-location') 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 -- cgit v1.1