diff options
author | Antoine Gourlay <antoine@gourlay.fr> | 2014-10-10 10:18:00 +0200 |
---|---|---|
committer | Antoine Gourlay <antoine@gourlay.fr> | 2014-10-13 10:37:18 +0200 |
commit | 2f54eb350038c48d0f0aadc6c8793ea0ef9ff80c (patch) | |
tree | c89dcd733c8e4224205aa07da6af8d8421457122 | |
parent | 2b5df373638d08204b71258928289f6b39e25d5f (diff) | |
download | scala-2f54eb350038c48d0f0aadc6c8793ea0ef9ff80c.tar.gz scala-2f54eb350038c48d0f0aadc6c8793ea0ef9ff80c.tar.bz2 scala-2f54eb350038c48d0f0aadc6c8793ea0ef9ff80c.zip |
SI-8711 ScalaVersion.unparse doesn't produce valid versions
There is no dot between `major.minor.rev` and `-build` in a scala
version, yet that's what unparse returns for
```
// was "2.11.3.-SNAPSHOT"
ScalaVersion("2.11.3-SNAPSHOT").unparse
```
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaVersion.scala | 2 | ||||
-rw-r--r-- | test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala b/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala index 4f45043c5e..43bdad5882 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala @@ -34,7 +34,7 @@ case object NoScalaVersion extends ScalaVersion { * to segregate builds */ case class SpecificScalaVersion(major: Int, minor: Int, rev: Int, build: ScalaBuild) extends ScalaVersion { - def unparse = s"${major}.${minor}.${rev}.${build.unparse}" + def unparse = s"${major}.${minor}.${rev}${build.unparse}" def compare(that: ScalaVersion): Int = that match { case SpecificScalaVersion(thatMajor, thatMinor, thatRev, thatBuild) => diff --git a/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala b/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala new file mode 100644 index 0000000000..77a2da828e --- /dev/null +++ b/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala @@ -0,0 +1,18 @@ +package scala.tools.nsc +package settings + +import org.junit.Assert._ +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import scala.tools.testing.AssertUtil.assertThrows + +@RunWith(classOf[JUnit4]) +class ScalaVersionTest { + // SI-8711 + @Test def versionUnparse() { + val v = "2.11.3" + + assertEquals(ScalaVersion(v).unparse, v) + } +} |