Merge pull request #159 from alexarchambault/topic/version-interval-fix

Really test version intervals...
This commit is contained in:
Alexandre Archambault 2016-02-22 23:49:08 +01:00
commit 70e2f978a4
3 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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.+"
)