summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2015-07-03 06:54:24 +0200
committerLukas Rytz <lukas.rytz@typesafe.com>2015-07-03 06:54:24 +0200
commit6ae2dd8dc4556e8085710122097c849fdeac6d95 (patch)
treed191c058c49e58b488e0ee959bf93c6663680f47 /test
parent4bbae6eb7454dcbb0970a1e982ebb842417d91c0 (diff)
parent9fa18ccfc0fd281ac111557fa317aef515c8a46f (diff)
downloadscala-6ae2dd8dc4556e8085710122097c849fdeac6d95.tar.gz
scala-6ae2dd8dc4556e8085710122097c849fdeac6d95.tar.bz2
scala-6ae2dd8dc4556e8085710122097c849fdeac6d95.zip
Merge pull request #4601 from som-snytt/issue/9377
SI-9377 ScalaVersion init no longer fails if versionless
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala9
-rw-r--r--test/junit/scala/tools/nsc/settings/SettingsTest.scala2
2 files changed, 10 insertions, 1 deletions
diff --git a/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala b/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala
index acbf39fe23..3717f80362 100644
--- a/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala
+++ b/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala
@@ -56,5 +56,14 @@ class ScalaVersionTest {
assertThrows[NumberFormatException] { ScalaVersion("2-") }
assertThrows[NumberFormatException] { ScalaVersion("2-.") } // scalacheck territory
assertThrows[NumberFormatException] { ScalaVersion("any.7") }
+
+ assertThrows[NumberFormatException] ( ScalaVersion("2.11-ok"), _ ==
+ "Bad version (2.11-ok) not major[.minor[.revision[-suffix]]]" )
+
+ }
+
+ // SI-9377
+ @Test def `missing version is as good as none`() {
+ assertEquals(NoScalaVersion, ScalaVersion(""))
}
}
diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
index 96f83c4c2f..1a2d695d68 100644
--- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala
+++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
@@ -178,6 +178,6 @@ class SettingsTest {
check(expected = "2.12", "-Xsource:2.12")
assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource"), _ == "-Xsource requires an argument, the syntax is -Xsource:<version>")
assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource", "2.11"), _ == "-Xsource requires an argument, the syntax is -Xsource:<version>")
- assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource:2.invalid"), _ contains "There was a problem parsing 2.invalid")
+ assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource:2.invalid"), _ contains "Bad version (2.invalid)")
}
}