diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-02-09 23:57:09 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-02-12 17:23:38 +0300 |
commit | c76874c5a1e57b4c3dc8d392f29b679d14a1d305 (patch) | |
tree | ac5226264355d73c74a1dc2e374b5369f81da02f /tests/repository-location | |
parent | cc2efd2c70b1cdd28c375674c62f9d5f131f6908 (diff) |
Add git_reference class
Diffstat (limited to 'tests/repository-location')
-rw-r--r-- | tests/repository-location/driver.cxx | 73 |
1 files changed, 49 insertions, 24 deletions
diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx index 098ecab..e5a818a 100644 --- a/tests/repository-location/driver.cxx +++ b/tests/repository-location/driver.cxx @@ -150,7 +150,7 @@ namespace bpkg assert (bad_loc ("c:\\aaa\\bbb")); #endif - // No URL fragment. + // Invalid/absent URL fragment. // #ifndef _WIN32 assert (bad_loc ("file://localhost/", repository_type::git)); @@ -158,6 +158,18 @@ namespace bpkg 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)); + + assert (bad_loc ("https://www.example.com/test.git#@", + repository_type::git)); + + assert (bad_loc ("https://www.example.com/test.git#@123", + repository_type::git)); + // Invalid version. // assert (bad_loc ("3/aaa/bbb")); @@ -410,25 +422,25 @@ namespace bpkg assert (l.type () == repository_type::bpkg); } { - repository_location l (loc ("git://github.com/test#master", + repository_location l (loc ("git://example.com/test#master", repository_type::git)); - assert (l.string () == "git://github.com/test#master"); - assert (l.canonical_name () == "git:github.com/test"); + assert (l.string () == "git://example.com/test#master"); + assert (l.canonical_name () == "git:example.com/test"); assert (l.proto () == proto::git); assert (l.type () == repository_type::git); } { - repository_location l (loc ("http://github.com/test.git#master", + repository_location l (loc ("http://example.com/test.git#master", repository_type::git)); - assert (l.string () == "http://github.com/test.git#master"); - assert (l.canonical_name () == "git:github.com/test"); + assert (l.string () == "http://example.com/test.git#master"); + assert (l.canonical_name () == "git:example.com/test"); assert (l.proto () == proto::http); } { - repository_location l (loc ("https://github.com/test.git#master", + repository_location l (loc ("https://example.com/test.git#master", repository_type::git)); - assert (l.string () == "https://github.com/test.git#master"); - assert (l.canonical_name () == "git:github.com/test"); + assert (l.string () == "https://example.com/test.git#master"); + assert (l.canonical_name () == "git:example.com/test"); assert (l.proto () == proto::https); assert (l.type () == repository_type::git); } @@ -487,22 +499,22 @@ namespace bpkg assert (l.canonical_name () == "bpkg:www.cppget.org/qw/a/b"); } { - repository_location l (loc ("https://git.github.com/test.git#master", + repository_location l (loc ("https://git.example.com/test.git#master", repository_type::git)); - assert (l.string () == "https://git.github.com/test.git#master"); - assert (l.canonical_name () == "git:github.com/test"); + assert (l.string () == "https://git.example.com/test.git#master"); + assert (l.canonical_name () == "git:example.com/test"); } { - repository_location l (loc ("https://scm.github.com/test.git#master", + repository_location l (loc ("https://scm.example.com/test.git#master", repository_type::git)); - assert (l.string () == "https://scm.github.com/test.git#master"); - assert (l.canonical_name () == "git:github.com/test"); + assert (l.string () == "https://scm.example.com/test.git#master"); + assert (l.canonical_name () == "git:example.com/test"); } { - repository_location l (loc ("https://www.github.com/test.git#master", + repository_location l (loc ("https://www.example.com/test.git#master", repository_type::git)); - assert (l.string () == "https://www.github.com/test.git#master"); - assert (l.canonical_name () == "git:github.com/test"); + assert (l.string () == "https://www.example.com/test.git#master"); + assert (l.canonical_name () == "git:example.com/test"); } { repository_location l (loc ("http://cppget.org/qw//1/a//b/")); @@ -711,14 +723,13 @@ namespace bpkg "http://cppget.org/foo/misc/stable"); } { - repository_location l ( - loc ("http://cppget.org/pkg/foo/1/misc/stable")); + repository_location l (loc ("http://cppget.org/pkg/foo/1/misc/stable")); assert (effective_url ("../..", l) == "http://cppget.org/pkg/foo/misc/stable"); } { - repository_location l (loc ("https://git.github.com/test.git#master", + repository_location l (loc ("https://git.example.com/test.git#master", repository_type::git)); assert (effective_url ("../..", l) == "../.."); } @@ -726,8 +737,7 @@ namespace bpkg repository_location l ( loc ("http://www.cppget.org/foo/bpkg/1/misc/stable")); - assert (effective_url ("../../..", l) == - "http://cppget.org/foo/misc"); + assert (effective_url ("../../..", l) == "http://cppget.org/foo/misc"); } { repository_location l (loc ("http://pkg.cppget.org/foo/pkg/1/misc")); @@ -741,6 +751,21 @@ namespace bpkg "http://cppget.org/foo/misc/abc"); } + // Repository URL fragments. + // + { + loc ("https://www.example.com/test.git#master", repository_type::git); + loc ("https://www.example.com/test.git#master@", repository_type::git); + + loc ("https://www.example.com/test.git#" + "@0a53e9ddeaddad63ad106860237bbf53411d11a7", + repository_type::git); + + loc ("https://www.example.com/test.git#" + "master@0a53e9ddeaddad63ad106860237bbf53411d11a7", + repository_type::git); + } + // repository_url // assert (repository_url ("git://example.com/test.git") == |