commit 8aa0842ed17171f59a78119b1637a916cc51f683
parent ceef6a046d1701d81790d7618c06013f83c82546
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 23 May 2016 18:39:01 -0400
version: allow 0.0 back
Diffstat:
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -644,7 +644,7 @@ string Browser::getValue(const Column col, const Entry &entry) const
if(entry.test(InstalledFlag))
display = regEntry.version.name();
- if(ver && *ver > regEntry.version) {
+ if(ver && (!regEntry || *ver > regEntry.version)) {
if(!display.empty())
display += '\x20';
diff --git a/src/version.cpp b/src/version.cpp
@@ -81,7 +81,7 @@ void Version::parse(const string &str)
swap(m_segments, segments);
- if(compare(Version()) < 1) {
+ if(m_segments.empty() || compare(Version()) < 0) {
swap(m_segments, segments); // restore original value, after compare()
throw reapack_error("invalid version name");
}
diff --git a/test/version.cpp b/test/version.cpp
@@ -43,6 +43,10 @@ TEST_CASE("parse valid versions", M) {
ver.parse("1.0");
REQUIRE(ver.isStable());
}
+
+ SECTION("equal to a null version") {
+ ver.parse("0");
+ }
}
TEST_CASE("parse invalid versions", M) {
@@ -64,11 +68,6 @@ TEST_CASE("parse invalid versions", M) {
FAIL();
}
- SECTION("equal to a null version") {
- ver.parse("0");
- FAIL();
- }
-
SECTION("lower than a null version") {
ver.parse("0-beta");
FAIL();