From 332c4e09b11b010a6ad50468230758d0874dbd60 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 29 Apr 2017 08:01:41 +0200 Subject: Add support for stub standard version --- tests/standard-version/driver.cxx | 14 ++++++++------ tests/standard-version/testscript | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 8 deletions(-) (limited to 'tests/standard-version') diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx index 86d9621..677ea8e 100644 --- a/tests/standard-version/driver.cxx +++ b/tests/standard-version/driver.cxx @@ -17,9 +17,11 @@ using namespace butl; // Create standard version from string, and also test another ctors. // static standard_version -version (const string& s, bool allow_earliest = true) +version (const string& s, + standard_version::flags f = + standard_version::allow_earliest | standard_version::allow_stub) { - standard_version r (s, allow_earliest); + standard_version r (s, f); try { @@ -29,7 +31,7 @@ version (const string& s, bool allow_earliest = true) ? r.string_snapshot () : string (), r.revision, - allow_earliest); + f); assert (r == v); @@ -39,12 +41,12 @@ version (const string& s, bool allow_earliest = true) r.snapshot () ? r.string_snapshot () : string (), - allow_earliest); + f); assert (r == v); if (!r.snapshot ()) { - standard_version v (r.version, allow_earliest); + standard_version v (r.version, f); assert (r == v); } } @@ -56,7 +58,7 @@ version (const string& s, bool allow_earliest = true) r.snapshot_sn, r.snapshot_id, r.revision, - allow_earliest); + f); assert (r == v); } diff --git a/tests/standard-version/testscript b/tests/standard-version/testscript index b6bc1a0..6a585a5 100644 --- a/tests/standard-version/testscript +++ b/tests/standard-version/testscript @@ -53,6 +53,13 @@ $* <>EOF 4~1.2.3 EOF + + : stub + : + $* <>EOF + 0 + 0+1 + EOF } : invalid @@ -74,9 +81,9 @@ : $* <'1.2' 2>"'.' expected after minor version" == 1 - : bugfix + : patch : - $* <'1.2.a' 2>'invalid bugfix version' == 1 + $* <'1.2.a' 2>'invalid patch version' == 1 : zero-version : @@ -153,6 +160,8 @@ $* '1.2.3-a.1' >y: final $* '1.2.3-a.0.1' >y: snapshot $* '1.2.3-' >y: earliest + $* '0' >n: stub + } : beta @@ -165,6 +174,7 @@ $* '1.2.3-b.1' >y: final $* '1.2.3-b.0.1' >y: snapshot $* '1.2.3-' >n: earliest + $* '0+1' >n: stub } : compare @@ -201,6 +211,12 @@ $* '1.2.3-a.0.1' '1.2.3-' >'1' : snapshot-gt-earliest $* '1.2.2-b.499.z' '1.2.3-' >'-1' : prev-max-snapshot-lt-earliest } + + : stub + : + { + $* '0+1' '0.0.1-' >'-1' : stub-lt-earliest + } } : constraints @@ -291,6 +307,10 @@ : $* <'==1.2.3-' 2>"invalid version: 'a' or 'b' expected in pre-release" == 1 + : eq-stub + : + $* <'==0' 2>"invalid version: '.' expected after major version" == 1 + : junk : $* <'>= 1.2.3-a.1.1.ads@' 2>'invalid version: junk after version' == 1 -- cgit v1.1