From 4676d650317d5208698c37b5af82f804bf8439ab Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 22 Feb 2016 22:18:52 +0100 Subject: [PATCH] Really test version intervals... ...and fix the tests --- core/shared/src/main/scala/coursier/core/Parse.scala | 7 +++++-- .../shapeless_2.11/{[2.2.0,2.3.0) => [2.2.0,2.3-a1)} | 0 .../src/test/scala/coursier/test/CentralTests.scala | 10 +++++----- 3 files changed, 10 insertions(+), 7 deletions(-) rename tests/shared/src/test/resources/resolutions/com.chuusai/shapeless_2.11/{[2.2.0,2.3.0) => [2.2.0,2.3-a1)} (100%) diff --git a/core/shared/src/main/scala/coursier/core/Parse.scala b/core/shared/src/main/scala/coursier/core/Parse.scala index eacc42788..8465ca05c 100644 --- a/core/shared/src/main/scala/coursier/core/Parse.scala +++ b/core/shared/src/main/scala/coursier/core/Parse.scala @@ -18,9 +18,12 @@ object Parse { last <- Some(from.rawItems.last).collect { case n: Version.Numeric => n } // a bit loose, but should do the job if from.repr.endsWith(last.repr) - to <- version(from.repr.stripSuffix(last.repr) + last.next.repr) + // appending -a1 to the next version, so has not to include things like + // nextVersion-RC1 in the interval - nothing like nextVersion* should be included + to <- version(from.repr.stripSuffix(last.repr) + last.next.repr + "-a1") // the contrary would mean something went wrong in the loose substitution above - if from.rawItems.init == to.rawItems.init + if from.rawItems.init == to.rawItems.dropRight(2).init + if to.rawItems.takeRight(2) == Seq(Version.Literal("a"), Version.Number(1)) } yield VersionInterval(Some(from), Some(to), fromIncluded = true, toIncluded = false) } else None diff --git a/tests/shared/src/test/resources/resolutions/com.chuusai/shapeless_2.11/[2.2.0,2.3.0) b/tests/shared/src/test/resources/resolutions/com.chuusai/shapeless_2.11/[2.2.0,2.3-a1) similarity index 100% rename from tests/shared/src/test/resources/resolutions/com.chuusai/shapeless_2.11/[2.2.0,2.3.0) rename to tests/shared/src/test/resources/resolutions/com.chuusai/shapeless_2.11/[2.2.0,2.3-a1) diff --git a/tests/shared/src/test/scala/coursier/test/CentralTests.scala b/tests/shared/src/test/scala/coursier/test/CentralTests.scala index 76ef8b9ac..9067b52ad 100644 --- a/tests/shared/src/test/scala/coursier/test/CentralTests.scala +++ b/tests/shared/src/test/scala/coursier/test/CentralTests.scala @@ -163,22 +163,22 @@ object CentralTests extends TestSuite { ) } 'latestRevision - { - resolutionCheck( + * - resolutionCheck( Module("com.chuusai", "shapeless_2.11"), - "[2.2.0,2.3.0)" + "[2.2.0,2.3-a1)" ) - resolutionCheck( + * - resolutionCheck( Module("com.chuusai", "shapeless_2.11"), "2.2.+" ) - resolutionCheck( + * - resolutionCheck( Module("com.googlecode.libphonenumber", "libphonenumber"), "[7.0,7.1)" ) - resolutionCheck( + * - resolutionCheck( Module("com.googlecode.libphonenumber", "libphonenumber"), "7.0.+" )