aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-04-19 22:43:08 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-04-19 22:43:08 +0300
commitbba520774fd6185f62a6bf52c61b98104a826f5f (patch)
tree4be19b347486932c7858349bb7a7c476e88dd5a4 /tests
parent7cf0854121525747b438b7f94bf2d050f61fb615 (diff)
Add support for comma-separated list of git reference filter
Diffstat (limited to 'tests')
-rw-r--r--tests/repository-location/driver.cxx30
1 files changed, 22 insertions, 8 deletions
diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx
index 2e39c26..ee8fba1 100644
--- a/tests/repository-location/driver.cxx
+++ b/tests/repository-location/driver.cxx
@@ -19,6 +19,7 @@ using namespace butl;
namespace bpkg
{
using butl::optional;
+ using butl::nullopt;
inline static repository_location
loc ()
@@ -99,6 +100,12 @@ namespace bpkg
return true;
}
+ inline static bool
+ operator== (const git_ref_filter& x, const git_ref_filter& y)
+ {
+ return x.commit == y.commit && x.name == y.name;
+ }
+
int
main (int argc, char* argv[])
{
@@ -159,6 +166,9 @@ namespace bpkg
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));
@@ -812,16 +822,20 @@ namespace bpkg
// Repository URL fragments.
//
{
- string branch ("master");
- string commit ("0a53e9ddeaddad63ad106860237bbf53411d11a7");
+ string n ("master");
+ string c ("0a53e9ddeaddad63ad106860237bbf53411d11a7");
+
+ assert (git_ref_filter (n) == git_ref_filter (n, nullopt));
+ assert (git_ref_filter (c + "@") == git_ref_filter (c, nullopt));
+ assert (git_ref_filter (c) == git_ref_filter (nullopt, c));
+ assert (git_ref_filter ("@" + c) == git_ref_filter (nullopt, c));
+ assert (git_ref_filter (n + "@" + c) == git_ref_filter (n, c));
- 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);
+ assert (parse_git_ref_filters ("tag") ==
+ git_ref_filters ({git_ref_filter ("tag")}));
- git_ref_filter r (branch + "@" + commit);
- assert (*r.name == branch && *r.commit == commit);
+ assert (parse_git_ref_filters ("a,b") ==
+ git_ref_filters ({git_ref_filter ("a"), git_ref_filter ("b")}));
}
// repository_url