diff options
-rw-r--r-- | libbutl/semantic-version.cxx | 26 | ||||
-rw-r--r-- | libbutl/semantic-version.mxx | 10 | ||||
-rw-r--r-- | libbutl/standard-version.cxx | 77 | ||||
-rw-r--r-- | libbutl/standard-version.ixx | 57 | ||||
-rw-r--r-- | libbutl/standard-version.mxx | 48 | ||||
-rw-r--r-- | tests/semantic-version/driver.cxx | 16 | ||||
-rw-r--r-- | tests/standard-version/driver.cxx | 11 | ||||
-rw-r--r-- | tests/standard-version/testscript | 191 |
8 files changed, 188 insertions, 248 deletions
diff --git a/libbutl/semantic-version.cxx b/libbutl/semantic-version.cxx index ef2a583..375e9e3 100644 --- a/libbutl/semantic-version.cxx +++ b/libbutl/semantic-version.cxx @@ -56,32 +56,28 @@ namespace butl uint64_t semantic_version:: numeric () const { - if (const char* w = (major > 999 ? "major version greater than 999" : - minor > 999 ? "minor version greater than 999" : - patch > 999 ? "patch version greater than 999" : + if (const char* w = (major > 99999 ? "major version greater than 99999" : + minor > 99999 ? "minor version greater than 99999" : + patch > 99999 ? "patch version greater than 99999" : nullptr)) throw invalid_argument (w); - // AAABBBCCC0000 - // 10000000000 - // 10000000 - // 10000 - // - return (major * 10000000000) + (minor * 10000000) + (patch * 10000); + // AAAAABBBBBCCCCC0000 BBBBBCCCCC0000 CCCCC0000 + return (major * 100000000000000) + (minor * 1000000000) + (patch * 10000); } semantic_version:: semantic_version (uint64_t n, std::string b) : build (move (b)) { - // AAABBBCCC0000 - if (n > 9999999990000ULL || (n % 1000) != 0) + // AAAAABBBBBCCCCC0000 + if (n > 9999999999999990000ULL || (n % 10000) != 0) throw invalid_argument ("invalid numeric representation"); - // AAABBBCCC0000 - major = n / 10000000000 % 1000; - minor = n / 10000000 % 1000; - patch = n / 10000 % 1000; + // AAAAABBBBBCCCCC0000 + major = n / 100000000000000 % 100000; + minor = n / 1000000000 % 100000; + patch = n / 10000 % 100000; } semantic_version:: diff --git a/libbutl/semantic-version.mxx b/libbutl/semantic-version.mxx index 35bf1b8..f143588 100644 --- a/libbutl/semantic-version.mxx +++ b/libbutl/semantic-version.mxx @@ -101,18 +101,18 @@ LIBBUTL_MODEXPORT namespace butl std::string string (bool ignore_build = false) const; - // Numeric representation in the AAABBBCCC0000 form, where: + // Numeric representation in the AAAAABBBBBCCCCC0000 form, where: // - // AAA - major version number - // BBB - minor version number - // CCC - patch version number + // AAAAA - major version number + // BBBBB - minor version number + // CCCCC - patch version number // // See standard version for details. // explicit semantic_version (std::uint64_t numeric, std::string build = ""); - // If any of the major/minor/patch components is greater than 999, then + // If any of the major/minor/patch components is greater than 99999, then // throw std::invalid_argument. The build component is ignored. // std::uint64_t diff --git a/libbutl/standard-version.cxx b/libbutl/standard-version.cxx index bb76ad6..f4517ef 100644 --- a/libbutl/standard-version.cxx +++ b/libbutl/standard-version.cxx @@ -69,19 +69,34 @@ namespace butl return true; } + template <typename T> static bool - parse_uint16 (const string& s, size_t& p, - uint16_t& r, - uint16_t min = 0, uint16_t max = 999) + parse_uint (const string& s, size_t& p, T& r, T min, T max) { uint64_t v; if (!parse_uint64 (s, p, v, min, max)) return false; - r = static_cast<uint16_t> (v); + r = static_cast<T> (v); return true; } + static inline bool + parse_uint16 (const string& s, size_t& p, + uint16_t& r, + uint16_t min = 0, uint16_t max = 999) + { + return parse_uint (s, p, r, min, max); + } + + static inline bool + parse_uint32 (const string& s, size_t& p, + uint32_t& r, + uint32_t min = 0, uint32_t max = 99999) + { + return parse_uint (s, p, r, min, max); + } + static void check_version (uint64_t vr, bool sn, standard_version::flags fl) { @@ -98,8 +113,8 @@ namespace butl { // Check that the version isn't too large, unless represents stub. // - // AAABBBCCCDDDE - r = vr < 10000000000000ULL; + // AAAAABBBBBCCCCCDDDE + r = vr < 10000000000000000000ULL; // Check that E version component is consistent with the snapshot flag. // Note that if the allow_earliest flag is set, then E can be 1 for the @@ -217,17 +232,20 @@ namespace butl return bail ("'-' expected after epoch"); } - uint16_t ma, mi, bf, ab (0); + uint32_t ma, mi, bf; + uint16_t ab (0); bool earliest (false); - if (!parse_uint16 (s, p, ma)) + if (!parse_uint32 (s, p, ma)) return bail ("invalid major version"); // The only valid version that has no epoch, contains only the major // version being equal to zero, that is optionally followed by the plus // character, is the stub version, unless forbidden. // - bool stub ((f & standard_version::allow_stub) != 0 && !ep && ma == 0 && + bool stub ((f & standard_version::allow_stub) != 0 && + !ep && + ma == 0 && (p == n || s[p] == '+')); if (stub) @@ -240,19 +258,19 @@ namespace butl if (s[p] != '.') return bail ("'.' expected after major version"); - if (!parse_uint16 (s, ++p, mi)) + if (!parse_uint32 (s, ++p, mi)) return bail ("invalid minor version"); if (s[p] != '.') return bail ("'.' expected after minor version"); - if (!parse_uint16 (s, ++p, bf)) + if (!parse_uint32 (s, ++p, bf)) return bail ("invalid patch version"); - // AAABBBCCCDDDE - r.version = ma * 10000000000ULL + - mi * 10000000ULL + - bf * 10000ULL; + // AAAAABBBBBCCCCCDDDE + r.version = ma * 100000000000000ULL + + mi * 1000000000ULL + + bf * 10000ULL; if (r.version == 0) return bail ("0.0.0 version"); @@ -403,9 +421,10 @@ namespace butl throw invalid_argument ("snapshot for stub"); } - if (!snapshot_id.empty () && (snapshot_id.size () > 16 || - snapshot_sn == 0 || - snapshot_sn == latest_sn)) + if (!snapshot_id.empty () && + (snapshot_id.size () > 16 || + snapshot_sn == 0 || + snapshot_sn == latest_sn)) throw invalid_argument ("invalid snapshot"); } @@ -494,9 +513,9 @@ namespace butl if (snapshot ()) // Trailing dot already in id. { - r += (snapshot_sn == latest_sn ? "z" : + r += (snapshot_sn == latest_sn ? "z" : snapshot_id.empty () ? to_string (snapshot_sn) : - snapshot_id); + snapshot_id); } return r; @@ -552,10 +571,10 @@ namespace butl if (c == '~' || (c == '^' && version.major () == 0)) { - // If for ~X.Y.Z Y is 999, then we cannot produce a valid X.Y+1.0- + // If for ~X.Y.Z Y is 99999, then we cannot produce a valid X.Y+1.0- // version (due to an overflow). // - if (version.minor () == 999) + if (version.minor () == 99999) { if (ignore_overflow) return standard_version (); @@ -563,16 +582,16 @@ namespace butl throw invalid_argument ("invalid minor version"); } - // AAABBBCCCDDDE - v = version.major () * 10000000000ULL + - (version.minor () + 1) * 10000000ULL; + // AAAAABBBBBCCCCCDDDE + v = version.major () * 100000000000000ULL + + (version.minor () + 1) * 1000000000ULL; } else { - // If for ^X.Y.Z X is 999, then we cannot produce a valid X+1.0.0- + // If for ^X.Y.Z X is 99999, then we cannot produce a valid X+1.0.0- // version (due to an overflow). // - if (version.major () == 999) + if (version.major () == 99999) { if (ignore_overflow) return standard_version (); @@ -580,8 +599,8 @@ namespace butl throw invalid_argument ("invalid major version"); } - // AAABBBCCCDDDE - v = (version.major () + 1) * 10000000000ULL; + // AAAAABBBBBCCCCCDDDE + v = (version.major () + 1) * 100000000000000ULL; } return standard_version (version.epoch, diff --git a/libbutl/standard-version.ixx b/libbutl/standard-version.ixx index 6142586..52cf9cb 100644 --- a/libbutl/standard-version.ixx +++ b/libbutl/standard-version.ixx @@ -4,7 +4,7 @@ namespace butl { - inline std::uint16_t standard_version:: + inline std::uint32_t standard_version:: major () const noexcept { std::uint64_t e (version % 10); @@ -13,10 +13,11 @@ namespace butl if (ab != 0 || e == 1) v += 1000 - ab; - return static_cast<std::uint16_t> (v / 1000000000 % 1000); + // AAAAABBBBBCCCCCDDD + return static_cast<std::uint32_t> (v / 10000000000000 % 100000); } - inline std::uint16_t standard_version:: + inline std::uint32_t standard_version:: minor () const noexcept { std::uint64_t e (version % 10); @@ -25,10 +26,11 @@ namespace butl if (ab != 0 || e == 1) v += 1000 - ab; - return static_cast<std::uint16_t> (v / 1000000 % 1000); + // AAAAABBBBBCCCCCDDD + return static_cast<std::uint32_t> (v / 100000000 % 100000); } - inline std::uint16_t standard_version:: + inline std::uint32_t standard_version:: patch () const noexcept { std::uint64_t e (version % 10); @@ -37,7 +39,8 @@ namespace butl if (ab != 0 || e == 1) v += 1000 - ab; - return static_cast<std::uint16_t> (v / 1000 % 1000); + // AAAAABBBBBCCCCCDDD + return static_cast<std::uint32_t> (v / 1000 % 100000); } inline bool standard_version:: @@ -87,23 +90,23 @@ namespace butl return snapshot () && snapshot_sn == latest_sn; } - // Note: in the following constructors we subtract one from AAABBBCCC if - // DDDE is not zero (see standard-version.hxx for details). + // Note: in the following constructors we subtract one from AAAAABBBBBCCCCC + // if DDDE is not zero (see standard-version.hxx for details). // inline standard_version:: standard_version (std::uint16_t ep, - std::uint16_t mj, - std::uint16_t mi, - std::uint16_t pa, + std::uint32_t mj, + std::uint32_t mi, + std::uint32_t pa, std::uint16_t pr, std::uint16_t rv) : standard_version (ep, - // AAABBBCCCDDDE - (mj * 10000000000ULL + - mi * 10000000ULL + - pa * 10000ULL + - pr * 10ULL - - (pr != 0 ? 10000ULL : 0ULL)), + // AAAAABBBBBCCCCCDDDE + (mj * 100000000000000ULL + + mi * 1000000000ULL + + pa * 10000ULL + + pr * 10ULL - + (pr != 0 ? 10000ULL : 0ULL)), "" /* snapshot */, rv) { @@ -111,21 +114,21 @@ namespace butl inline standard_version:: standard_version (std::uint16_t ep, - std::uint16_t mj, - std::uint16_t mi, - std::uint16_t pa, + std::uint32_t mj, + std::uint32_t mi, + std::uint32_t pa, std::uint16_t pr, std::uint64_t sn, std::string si, std::uint16_t rv) : standard_version (ep, - // AAABBBCCCDDDE - (mj * 10000000000ULL + - mi * 10000000ULL + - pa * 10000ULL + - pr * 10ULL + - 1ULL /* snapshot */ - - 10000ULL), + // AAAAABBBBBCCCCCDDDE + (mj * 100000000000000ULL + + mi * 1000000000ULL + + pa * 10000ULL + + pr * 10ULL + + 1ULL /* snapshot */ - + 10000ULL), sn, si, rv) diff --git a/libbutl/standard-version.mxx b/libbutl/standard-version.mxx index c899e57..3c38242 100644 --- a/libbutl/standard-version.mxx +++ b/libbutl/standard-version.mxx @@ -52,24 +52,24 @@ LIBBUTL_MODEXPORT namespace butl // snapshot (release is naturally always final). Pre-release can be alpha or // beta. // - // The numeric version format is AAABBBCCCDDDE where: + // The numeric version format is AAAAABBBBBCCCCCDDDE where: // - // AAA - major version number - // BBB - minor version number - // CCC - patch version number - // DDD - alpha / beta (DDD + 500) version number - // E - final (0) / snapshot (1) + // AAAAA - major version number + // BBBBB - minor version number + // CCCCC - patch version number + // DDD - alpha / beta (DDD + 500) version number + // E - final (0) / snapshot (1) // - // When DDDE is not 0, 1 is subtracted from AAABBBCCC. For example: + // When DDDE is not 0, 1 is subtracted from AAAAABBBBBCCCCC. For example: // - // Version AAABBBCCCDDDE + // Version AAAAABBBBBCCCCCDDDE // - // 0.1.0 0000010000000 - // 0.1.2 0000010010000 - // 1.2.3 0010020030000 - // 2.2.0-a.1 0020019990010 - // 3.0.0-b.2 0029999995020 - // 2.2.0-a.1.z 0020019990011 + // 0.1.0 0000000001000000000 + // 0.1.2 0000000001000020000 + // 1.2.3 0000100002000030000 + // 2.2.0-a.1 0000200001999990010 + // 3.0.0-b.2 0000299999999995020 + // 2.2.0-a.1.z 0000200001999990011 // // Stub is represented as ~0 (but is not considered a pre-release). // @@ -88,14 +88,14 @@ LIBBUTL_MODEXPORT namespace butl static const std::uint64_t latest_sn = std::uint64_t (~0); std::uint16_t epoch = 1; // 0 if a stub, 1 if not specified. - std::uint64_t version = 0; // AAABBBCCCDDDE or ~0 for stub. + std::uint64_t version = 0; // AAAAABBBBBCCCCCDDDE or ~0 for stub. std::uint64_t snapshot_sn = 0; // 0 if not specifed, latest_sn if 'z'. std::string snapshot_id; // Empty if not specified. std::uint16_t revision = 0; // 0 if not specified. - std::uint16_t major () const noexcept; - std::uint16_t minor () const noexcept; - std::uint16_t patch () const noexcept; + std::uint32_t major () const noexcept; + std::uint32_t minor () const noexcept; + std::uint32_t patch () const noexcept; // Return the alpha/beta version number if pre-release and nullopt // otherwise. @@ -201,16 +201,16 @@ LIBBUTL_MODEXPORT namespace butl // by 500 for betas. // standard_version (std::uint16_t epoch, - std::uint16_t major, - std::uint16_t minor, - std::uint16_t patch, + std::uint32_t major, + std::uint32_t minor, + std::uint32_t patch, std::uint16_t pre_release = 0, std::uint16_t revision = 0); standard_version (std::uint16_t epoch, - std::uint16_t major, - std::uint16_t minor, - std::uint16_t patch, + std::uint32_t major, + std::uint32_t minor, + std::uint32_t patch, std::uint16_t pre_release, std::uint64_t snapshot_sn, std::string snapshot_id, diff --git a/tests/semantic-version/driver.cxx b/tests/semantic-version/driver.cxx index 9ffe671..bcc0cc2 100644 --- a/tests/semantic-version/driver.cxx +++ b/tests/semantic-version/driver.cxx @@ -73,12 +73,12 @@ main () // Numeric representation. // - // AAABBBCCC0000 - assert (semver ( 10020030000ULL) == semver (1, 2, 3)); - assert (semver ( 9999999990000ULL, ".4") == semver (999, 999, 999, ".4")); - try { semver v ( 10020030001ULL); assert (false);} catch (failed) {} - try { semver v (10000020030000ULL); assert (false);} catch (failed) {} - assert (semver (1, 2, 3).numeric () == 10020030000ULL); - assert (semver (999, 999, 999, ".4").numeric () == 9999999990000ULL); - try { semver (9999, 0, 0).numeric (); assert (false);} catch (failed) {} + // AAAAABBBBBCCCCC0000 + assert (semver ( 100002000030000ULL) == semver (1, 2, 3)); + assert (semver ( 9999999999999990000ULL, ".4") == semver (99999, 99999, 99999, ".4")); + try { semver v ( 100002000030001ULL); assert (false);} catch (failed) {} + try { semver v (10000000200003000000ULL); assert (false);} catch (failed) {} + assert ( 100002000030000ULL == semver (1, 2, 3).numeric ()); + assert ( 9999999999999990000ULL == semver (99999, 99999, 99999, ".4").numeric ()); + try { semver (999999, 0, 0).numeric (); assert (false);} catch (failed) {} } diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx index 54fcfb8..87b6fa0 100644 --- a/tests/standard-version/driver.cxx +++ b/tests/standard-version/driver.cxx @@ -95,15 +95,15 @@ version (const string& s, : e + to_string (v.major () + 1) + ".0.0-"; }; - if (v.minor () != 999) + if (v.minor () != 99999) { standard_version_constraint c1 ("~" + s); standard_version_constraint c2 ('[' + s + ' ' + max_ver ('~') + ')'); assert (c1 == c2); } - if ((v.major () == 0 && v.minor () != 999) || - (v.major () != 0 && v.major () != 999)) + if ((v.major () == 0 && v.minor () != 99999) || + (v.major () != 0 && v.major () != 99999)) { standard_version_constraint c1 ("^" + s); standard_version_constraint c2 ('[' + s + ' ' + max_ver ('^') + ')'); @@ -160,9 +160,12 @@ version (const string& s, // -sn output 'y' for snapshot, 'n' otherwise // -fn output 'y' for final, 'n' otherwise // -// -cm output 0 if versions are equal, -1 if the first one is less, 1 otherwise +// -cm output 0 if versions are equal, -1 if the first one is less, 1 +// otherwise +// // -cr create version constraints from stdin lines, optionally using the // dependent version, and print them to stdout +// // -sf output 'y' if version satisfies constraint, 'n' otherwise // // If no options are specified, then create versions from stdin lines, and diff --git a/tests/standard-version/testscript b/tests/standard-version/testscript index eb3603b..06361bd 100644 --- a/tests/standard-version/testscript +++ b/tests/standard-version/testscript @@ -70,101 +70,44 @@ : max : $* <<EOF >>EOF - 1.2.999 - 1.999.999 - 999.999.999 + 1.2.99999 + 1.99999.99999 + 99999.99999.99999 EOF } : invalid : { - : epoch - : - $* <'+1+' 2>"'-' expected after epoch" == 1 - - : major - : - $* <'a' 2>'invalid major version' == 1 - - : no-major-dot - : - $* <'1' 2>"'.' expected after major version" == 1 - - : minor - : - $* <'1.a' 2>'invalid minor version' == 1 - - : no-minor-dot - : - $* <'1.2' 2>"'.' expected after minor version" == 1 - - : patch - : - $* <'1.2.a' 2>'invalid patch version' == 1 - - : zero-version - : - $* <'+1-0.0.0' 2>'0.0.0 version' == 1 - - : a-b-expected - : - $* <'1.2.3-k' 2>"'a' or 'b' expected in pre-release" == 1 - - : prerelease-dot-expected - : - $* <'1.2.3-a' 2>"'.' expected after pre-release letter" == 1 - - : prerelease - : - $* <'1.2.3-a.b' 2>'invalid pre-release' == 1 - - : final-prerelease - : - $* <'1.2.3-b.0' 2>'invalid final pre-release' == 1 - - : snapshot-num - : - $* <'1.2.3-a.1.0' 2>'invalid snapshot number' == 1 - - : snapshot-id - : - $* <'1.2.3-a.1.1.@' 2>'invalid snapshot id' == 1 + $* <'+1+' 2>"'-' expected after epoch" == 1 : epoch + $* <'a' 2>'invalid major version' == 1 : major + $* <'1' 2>"'.' expected after major version" == 1 : no-major-dot + $* <'1.a' 2>'invalid minor version' == 1 : minor + $* <'1.2' 2>"'.' expected after minor version" == 1 : no-minor-dot + $* <'1.2.a' 2>'invalid patch version' == 1 : patch + $* <'+1-0.0.0' 2>'0.0.0 version' == 1 : zero-version + $* <'1.2.3-k' 2>"'a' or 'b' expected in pre-release" == 1 : a-b-expected + $* <'1.2.3-a' 2>"'.' expected after pre-release letter" == 1 : prerelease-dot-expected + $* <'1.2.3-a.b' 2>'invalid pre-release' == 1 : prerelease + $* <'1.2.3-b.0' 2>'invalid final pre-release' == 1 : final-prerelease + $* <'1.2.3-a.1.0' 2>'invalid snapshot number' == 1 : snapshot-num + $* <'1.2.3-a.1.1.@' 2>'invalid snapshot id' == 1 : snapshot-id : revision : { - : non-prerelease - : - $* <'1.2.3+a' 2>'invalid revision' == 1 - - : prerelease - : - $* <'1.2.3-a.1+a' 2>'invalid revision' == 1 - - : snapshot-num - : - $* <'1.2.3-a.0.1+a' 2>'invalid revision' == 1 - - : snapshot-id - : - $* <'1.2.3-a.0.1.83jdgsf+0' 2>'invalid revision' == 1 - - : earliest-prerelease - : - $* <'1.2.3-+1' 2>"'a' or 'b' expected in pre-release" == 1 + $* <'1.2.3+a' 2>'invalid revision' == 1 : non-prerelease + $* <'1.2.3-a.1+a' 2>'invalid revision' == 1 : prerelease + $* <'1.2.3-a.0.1+a' 2>'invalid revision' == 1 : snapshot-num + $* <'1.2.3-a.0.1.83jdgsf+0' 2>'invalid revision' == 1 : snapshot-id + $* <'1.2.3-+1' 2>"'a' or 'b' expected in pre-release" == 1 : earliest-prerelease } : trailing-junk-after : { - : snapshot-num - : - $* <'1.2.3-a.1.z.a' 2>'junk after version' == 1 - - : revision - : - $* <'1.2.3-a.1.z+1a' 2>'junk after version' == 1 + $* <'1.2.3-a.1.z.a' 2>'junk after version' == 1 : snapshot-num + $* <'1.2.3-a.1.z+1a' 2>'junk after version' == 1 : revision } } @@ -332,43 +275,28 @@ [1.2.3 1.2.4] (1.2.3 1.2.4) [ 1.2.3- 1.2.4- ] - [1.999.0 2.0.0) + [1.99999.0 2.0.0) EOI [1.2.3 1.2.4] (1.2.3 1.2.4) [1.2.3- 1.2.4-] - [1.999.0 2.0.0) + [1.99999.0 2.0.0) EOE : invalid : { - $* <'' 2>'invalid constraint' == 1 : empty - $* <'1' 2>'invalid constraint' == 1 : no-opening - $* <'[ ' 2>'no min version' == 1 : no-min - $* <'[1.2.3' 2>'no max version' == 1 : no-max - $* <'[1.2.3 1.2.4' 2>'no closing bracket' == 1 : no-closing - $* <'[1.2.3 1.2.4)]' 2>'junk after constraint' == 1 : junk - - : invalid-min - : - $* <'[1' 2>"invalid min version: '.' expected after major version" == 1 - - : invalid-max - : - $* <'[1.2.3 1' 2>"invalid max version: '.' expected after major version" == 1 - - : min-gt-max - : - $* <'[999.0.0 1.0.0)' 2>'min version is greater than max version' == 1 - - : open-end - : - $* <'[1.2.3 1.2.3)' 2>'equal version endpoints not closed' == 1 - - : earliest-prerelease - : - $* <'[1.2.3- 1.2.3-]' 2>'equal version endpoints are earliest' == 1 + $* <'' 2>'invalid constraint' == 1 : empty + $* <'1' 2>'invalid constraint' == 1 : no-opening + $* <'[ ' 2>'no min version' == 1 : no-min + $* <'[1.2.3' 2>'no max version' == 1 : no-max + $* <'[1.2.3 1.2.4' 2>'no closing bracket' == 1 : no-closing + $* <'[1.2.3 1.2.4)]' 2>'junk after constraint' == 1 : junk + $* <'[1' 2>"invalid min version: '.' expected after major version" == 1 : invalid-min + $* <'[1.2.3 1' 2>"invalid max version: '.' expected after major version" == 1 : invalid-max + $* <'[99999.0.0 1.0.0)' 2>'min version is greater than max version' == 1 : min-gt-max + $* <'[1.2.3 1.2.3)' 2>'equal version endpoints not closed' == 1 : open-end + $* <'[1.2.3- 1.2.3-]' 2>'equal version endpoints are earliest' == 1 : earliest-prerelease } } @@ -402,19 +330,10 @@ : invalid : { - $* <'>=' 2>'no version' == 1 : no-version - - : eq-earliest - : - $* <'==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 + $* <'>=' 2>'no version' == 1 : no-version + $* <'==1.2.3-' 2>"invalid version: 'a' or 'b' expected in pre-release" == 1 : eq-earliest + $* <'==0' 2>"invalid version: '.' expected after major version" == 1 : eq-stub + $* <'>= 1.2.3-a.1.1.ads@' 2>'invalid version: junk after version' == 1 : junk } } @@ -456,12 +375,12 @@ : invalid : { - $* <'-1.2.3' 2>'invalid constraint' == 1 : bad-char - $* <'~' 2>'no version' == 1 : no-version - $* <'~1.2' 2>"invalid version: '.' expected after minor version" == 1 : bad-ver - $* <'~1.999.0' 2>"invalid version: invalid minor version" == 1 : bad-min-tilde - $* <'^0.999.0' 2>"invalid version: invalid minor version" == 1 : bad-min-caret - $* <'^999.0.0' 2>"invalid version: invalid major version" == 1 : bad-maj-caret + $* <'-1.2.3' 2>'invalid constraint' == 1 : bad-char + $* <'~' 2>'no version' == 1 : no-version + $* <'~1.2' 2>"invalid version: '.' expected after minor version" == 1 : bad-ver + $* <'~1.99999.0' 2>"invalid version: invalid minor version" == 1 : bad-min-tilde + $* <'^0.99999.0' 2>"invalid version: invalid minor version" == 1 : bad-min-caret + $* <'^99999.0.0' 2>"invalid version: invalid major version" == 1 : bad-maj-caret } } } @@ -519,8 +438,8 @@ : invalid : { - $* '' <'== $' 2>'dependent version is empty' == 1 : empty-version - $* '1.2.3-' <'== $' 2>'dependent version is earliest' == 1 : earliest-version + $* '' <'== $' 2>'dependent version is empty' == 1 : empty-version + $* '1.2.3-' <'== $' 2>'dependent version is earliest' == 1 : earliest-version $* '1.2.3-a.0.z' <'== $' 2>'invalid version: dependent version is latest snapshot' == 1 : latest-version $* '0+1' <'== $' 2>'invalid version: dependent version is stub' == 1 : stub-version } @@ -681,18 +600,18 @@ $* '1.2.3-b.499' '~1.2.3' >n : out-left $* '1.2.3' '~1.2.3' >y : in-left $* '1.2.4' '~1.2.3' >y : in - $* '1.2.999' '~1.2.3' >y : in-right + $* '1.2.99999' '~1.2.3' >y : in-right $* '1.3.0-' '~1.2.3' >n : out-right } : caret : { - $* '1.2.3-b.499' '^1.2.3' >n : out-left - $* '1.2.3' '^1.2.3' >y : in-left - $* '1.3.0' '^1.2.3' >y : in - $* '1.999.999' '^1.2.3' >y : in-right - $* '2.0.0-' '^1.2.3' >n : out-right + $* '1.2.3-b.499' '^1.2.3' >n : out-left + $* '1.2.3' '^1.2.3' >y : in-left + $* '1.3.0' '^1.2.3' >y : in + $* '1.99999.99999' '^1.2.3' >y : in-right + $* '2.0.0-' '^1.2.3' >n : out-right } : caret-zero-major @@ -701,7 +620,7 @@ $* '0.2.3-b.499' '^0.2.3' >n : out-left $* '0.2.3' '^0.2.3' >y : in-left $* '0.2.4' '^0.2.3' >y : in - $* '0.2.999' '^0.2.3' >y : in-right + $* '0.2.99999' '^0.2.3' >y : in-right $* '0.3.0-' '^0.2.3' >n : out-right } } |