aboutsummaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-18 10:08:48 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commit2dbd9ec3efae8a3814e6bece0f7ed45038c30380 (patch)
tree06a4e2da2eb290315ce859933f88db97793ead27 /tests/src
parentc2b6468835b6174ce6474910fc488931dfd003a4 (diff)
Fix version range not ending at next major version when not defining end
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/confTest/confTest.cpp4
-rw-r--r--tests/src/versionTest.cpp22
2 files changed, 19 insertions, 7 deletions
diff --git a/tests/src/confTest/confTest.cpp b/tests/src/confTest/confTest.cpp
index a86dbb3..ec8a563 100644
--- a/tests/src/confTest/confTest.cpp
+++ b/tests/src/confTest/confTest.cpp
@@ -26,11 +26,11 @@ TEST_CASE("parse config")
}
auto *xxhashDependency = sibsConfig.getPackageListDependencies()[0]->asPackageListDependency();
REQUIRE(xxhashDependency->name == "xxhash");
- REQUIRE(xxhashDependency->version.toString() == ">=0.1.0");
+ REQUIRE(xxhashDependency->version.toString() == ">=0.1.0 and <1.0.0");
const auto &catch2Dependency = sibsConfig.getPackageListDependencies()[1]->asPackageListDependency();
REQUIRE(catch2Dependency->name == "catch2");
- REQUIRE(catch2Dependency->version.toString() == ">=1.0.0");
+ REQUIRE(catch2Dependency->version.toString() == ">=1.0.0 and <2.0.0");
REQUIRE(sibsConfig.getGitDependencies().size() == 1);
for(auto *dep : sibsConfig.getGitDependencies())
diff --git a/tests/src/versionTest.cpp b/tests/src/versionTest.cpp
index d5a492c..48a8838 100644
--- a/tests/src/versionTest.cpp
+++ b/tests/src/versionTest.cpp
@@ -7,16 +7,20 @@ TEST_CASE("parse package version")
{
VersionParser parser;
{
- Result<PackageVersionRange> parseResult = parser.parse("2.3.4", 5);
+ Result<PackageVersionRange> parseResult = parser.parse("17.3.4", 6);
if(!parseResult)
FAIL(parseResult.getErrMsg());
PackageVersionRange versionRange = parseResult.unwrap();
REQUIRE(versionRange.startDefined);
- REQUIRE(!versionRange.endDefined);
+ REQUIRE(versionRange.endDefined);
REQUIRE(versionRange.startOperation == VersionOperation::GREATER_EQUAL);
- REQUIRE(versionRange.start.major == 2);
+ REQUIRE(versionRange.start.major == 17);
REQUIRE(versionRange.start.minor == 3);
REQUIRE(versionRange.start.patch == 4);
+ REQUIRE(versionRange.endOperation == VersionOperation::LESS);
+ REQUIRE(versionRange.end.major == 18);
+ REQUIRE(versionRange.end.minor == 0);
+ REQUIRE(versionRange.end.patch == 0);
}
{
Result<PackageVersionRange> parseResult = parser.parse("2.3", 3);
@@ -24,11 +28,15 @@ TEST_CASE("parse package version")
FAIL(parseResult.getErrMsg());
PackageVersionRange versionRange = parseResult.unwrap();
REQUIRE(versionRange.startDefined);
- REQUIRE(!versionRange.endDefined);
+ REQUIRE(versionRange.endDefined);
REQUIRE(versionRange.startOperation == VersionOperation::GREATER_EQUAL);
REQUIRE(versionRange.start.major == 2);
REQUIRE(versionRange.start.minor == 3);
REQUIRE(versionRange.start.patch == 0);
+ REQUIRE(versionRange.endOperation == VersionOperation::LESS);
+ REQUIRE(versionRange.end.major == 3);
+ REQUIRE(versionRange.end.minor == 0);
+ REQUIRE(versionRange.end.patch == 0);
}
{
Result<PackageVersionRange> parseResult = parser.parse("2", 1);
@@ -36,11 +44,15 @@ TEST_CASE("parse package version")
FAIL(parseResult.getErrMsg());
PackageVersionRange versionRange = parseResult.unwrap();
REQUIRE(versionRange.startDefined);
- REQUIRE(!versionRange.endDefined);
+ REQUIRE(versionRange.endDefined);
REQUIRE(versionRange.startOperation == VersionOperation::GREATER_EQUAL);
REQUIRE(versionRange.start.major == 2);
REQUIRE(versionRange.start.minor == 0);
REQUIRE(versionRange.start.patch == 0);
+ REQUIRE(versionRange.endOperation == VersionOperation::LESS);
+ REQUIRE(versionRange.end.major == 3);
+ REQUIRE(versionRange.end.minor == 0);
+ REQUIRE(versionRange.end.patch == 0);
}
{
Result<PackageVersionRange> parseResult = parser.parse(">=2.3.4 and <5.6.7", 18);