From 05e0f5ca9e9a916746bd6b26baff317663674574 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Apr 2018 12:46:10 +0300 Subject: Add support for default and excluding git ref filters --- tests/repository-location/driver.cxx | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx index ee8fba1..8916df9 100644 --- a/tests/repository-location/driver.cxx +++ b/tests/repository-location/driver.cxx @@ -103,7 +103,8 @@ namespace bpkg inline static bool operator== (const git_ref_filter& x, const git_ref_filter& y) { - return x.commit == y.commit && x.name == y.name; + return x.commit == y.commit && x.name == y.name && + x.exclusion == y.exclusion; } int @@ -825,16 +826,25 @@ namespace bpkg 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 () == git_ref_filter (nullopt, nullopt, false)); + assert (git_ref_filter (n) == git_ref_filter (n, nullopt, false)); + assert (git_ref_filter ('+' + n) == git_ref_filter (n, nullopt, false)); + assert (git_ref_filter ('-' + n) == git_ref_filter (n, nullopt, true)); + assert (git_ref_filter (c + "@") == git_ref_filter (c, nullopt, false)); + assert (git_ref_filter (c) == git_ref_filter (nullopt, c, false)); + assert (git_ref_filter ("@" + c) == git_ref_filter (nullopt, c, false)); + assert (git_ref_filter (n + "@" + c) == git_ref_filter (n, c, false)); - assert (parse_git_ref_filters ("tag") == + assert (parse_git_ref_filters (nullopt) == + git_ref_filters {git_ref_filter ()}); + + assert (parse_git_ref_filters (string ("tag")) == git_ref_filters ({git_ref_filter ("tag")})); - assert (parse_git_ref_filters ("a,b") == + assert (parse_git_ref_filters (string ("#tag")) == + git_ref_filters ({git_ref_filter (), git_ref_filter ("tag")})); + + assert (parse_git_ref_filters (string ("a,b")) == git_ref_filters ({git_ref_filter ("a"), git_ref_filter ("b")})); } -- cgit v1.1