mirror of https://github.com/sbt/sbt.git
bport: Handle partialVersion("2")
https://github.com/sbt/librarymanagement/pull/528
This commit is contained in:
parent
95b4ea386f
commit
827efb6ee6
|
|
@ -24,6 +24,7 @@ object CrossVersionUtil {
|
|||
private val basicVersion = raw"""($longPattern)\.($longPattern)\.($longPattern)"""
|
||||
private val tagPattern = raw"""(?:\w+(?:\.\w+)*)"""
|
||||
private val ReleaseV = raw"""$basicVersion(-\d+)?""".r
|
||||
private val MajorV = raw"""($longPattern)""".r
|
||||
private[sbt] val BinCompatV = raw"""$basicVersion(-$tagPattern)?-bin(-.*)?""".r
|
||||
private val CandidateV = raw"""$basicVersion(-RC\d+)""".r
|
||||
private val NonReleaseV_n =
|
||||
|
|
@ -72,6 +73,7 @@ object CrossVersionUtil {
|
|||
private[sbt] def partialVersion(s: String): Option[(Long, Long)] =
|
||||
s match {
|
||||
case PartialVersion(major, minor) => Some((major.toLong, minor.toLong))
|
||||
case MajorV(major) => Some((major.toLong, 0L))
|
||||
case _ => None
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,12 @@ class CrossVersionTest extends UnitSpec {
|
|||
it should "for 2.0.0 return Some((2, 0))" in {
|
||||
sbtApiVersion("2.0.0") shouldBe Some((2, 0))
|
||||
}
|
||||
|
||||
"partialVersion" should "return None for xyz" in {
|
||||
assert(partialVersion("xyz") == None)
|
||||
}
|
||||
it should "return 2 for 2" in {
|
||||
assert(partialVersion("2") == Some((2, 0)))
|
||||
}
|
||||
"isSbtApiCompatible" should "for 0.12.0-M1 return false" in {
|
||||
isSbtApiCompatible("0.12.0-M1") shouldBe false
|
||||
}
|
||||
|
|
@ -106,6 +111,9 @@ class CrossVersionTest extends UnitSpec {
|
|||
it should "for 2.0.0-RC1 return 2" in {
|
||||
binarySbtVersion("2.0.0-RC1") shouldBe "2"
|
||||
}
|
||||
it should "for 2 return 2" in {
|
||||
binarySbtVersion("2") shouldBe "2"
|
||||
}
|
||||
it should "for 2.1.0-M1 return 2" in {
|
||||
binarySbtVersion("2.1.0-M1") shouldBe "2"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue