diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-08-30 20:55:55 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-09-05 16:33:50 +0300 |
commit | a6bf026d143b559ac0358dfd4b89f317901fd02e (patch) | |
tree | 77d47f219e97c222a641749af0ad1d3f0e366b53 /tests/package-version | |
parent | ad801af7a975a5400f798c77d3d9cdaf3ed5121a (diff) |
Make version revision optional
Diffstat (limited to 'tests/package-version')
-rw-r--r-- | tests/package-version/driver.cxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/package-version/driver.cxx b/tests/package-version/driver.cxx index e81115a..5cf7e09 100644 --- a/tests/package-version/driver.cxx +++ b/tests/package-version/driver.cxx @@ -123,6 +123,7 @@ namespace bpkg assert (bad_version ("1-a.00000000000000000")); // Same. assert (bad_version (0, "1", "", 1)); // Revision for empty release. + assert (bad_version (0, "1", "", 0)); // Same. assert (bad_version (1, "+1-1.1", "", 2)); // Epoch in upstream. assert (bad_version (1, "1.1-1", "", 2)); // Release in upstream. assert (bad_version (1, "1.1+1", "", 2)); // Revision in upstream. @@ -133,6 +134,7 @@ namespace bpkg assert (bad_version (1, "", "", 0)); // Unexpected epoch. assert (bad_version (0, "", "1", 0)); // Unexpected release. assert (bad_version (0, "", "", 1)); // Unexpected revision. + assert (bad_version (0, "", "", 0)); // Same. assert (bad_version (0, "", "", 0, 1)); // Unexpected iteration. { @@ -243,12 +245,24 @@ namespace bpkg assert (test_constructor (v)); } { + version v ("+10-B"); + assert (v.string () == "+10-B"); + assert (v.canonical_upstream == "b"); + assert (test_constructor (v)); + } + { version v ("+10-B+0"); assert (v.string () == "+10-B"); assert (v.canonical_upstream == "b"); assert (test_constructor (v)); } { + version v ("+10-B+0", false /* fold_zero_revision */); + assert (v.string () == "+10-B+0"); + assert (v.canonical_upstream == "b"); + assert (test_constructor (v)); + } + { version v ("+3-1A.31.0.4.0+7"); assert (v.string () == "+3-1A.31.0.4.0+7"); assert (v.canonical_upstream == @@ -298,7 +312,7 @@ namespace bpkg assert (test_constructor (v)); } { - version v (2, "1", string (), 0, 0); + version v (2, "1", string (), nullopt, 0); assert (v.string () == "+2-1-"); assert (v.release && v.release->empty ()); assert (v.canonical_release.empty ()); @@ -311,7 +325,8 @@ namespace bpkg assert (v.string (true, false) == "+3-2.0"); assert (v.string (false, true) == "+3-2.0+3"); - assert (version (3, "2.0", nullopt, 0, 1).string () == "+3-2.0#1"); + assert (version (3, "2.0", nullopt, nullopt, 1).string () == "+3-2.0#1"); + assert (version (3, "2.0", nullopt, 0, 1).string () == "+3-2.0+0#1"); assert (version (3, "2.0", nullopt, 1, 0).string () == "+3-2.0+1"); } @@ -363,8 +378,8 @@ namespace bpkg assert (version ("1.1.1a+1") < version ("1.1.1b")); assert (version (1, "2.0", nullopt, 3, 0) == version ("+1-2+3")); - assert (version (1, "2.0", string (), 0, 0) == version ("+1-2-")); - assert (version (0, "", string (), 0, 0) == version ()); + assert (version (1, "2.0", string (), nullopt, 0) == version ("+1-2-")); + assert (version (0, "", string (), nullopt, 0) == version ()); assert (version (1, "2.0", nullopt, 3, 4).compare ( version (1, "2.0", nullopt, 3, 4)) == 0); |