diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-11-05 16:27:40 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-11-05 16:27:40 +0100 |
commit | 494914346ed6f27b44283f4850383582a7a7f6d1 (patch) | |
tree | 711a30c845dea425c0879552082f88ddcddeec96 /test/junit | |
parent | ae70f020cdd22d155882191ca60d40542615b606 (diff) | |
parent | 3f77202a0167f30454b3cc059a675cc9230ff603 (diff) | |
download | scala-494914346ed6f27b44283f4850383582a7a7f6d1.tar.gz scala-494914346ed6f27b44283f4850383582a7a7f6d1.tar.bz2 scala-494914346ed6f27b44283f4850383582a7a7f6d1.zip |
Merge pull request #4017 from lrytz/t6541
SI-6541 valid wildcard existentials for case-module-unapply
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/settings/SettingsTest.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala index eda0c27834..96f83c4c2f 100644 --- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala +++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala @@ -164,4 +164,20 @@ class SettingsTest { assertThrows[IllegalArgumentException](check("-m:a,b,-ab")(_ => true), _ contains "'ab' cannot be negated") assertThrows[IllegalArgumentException](check("-m:a,ac,-uber,uber")(_ => true), _ contains "'uber' cannot be negated") } + + @Test def xSourceTest(): Unit = { + def check(expected: String, args: String*): Unit = { + val s = new MutableSettings(msg => throw new IllegalArgumentException(msg)) + val (_, residual) = s.processArguments(args.toList, processAll = true) + assert(residual.isEmpty) + assertTrue(s.source.value == ScalaVersion(expected)) + } + check(expected = "2.11.0") // default + check(expected = "2.11.0", "-Xsource:2.11") + check(expected = "2.10", "-Xsource:2.10.0") + 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") + } } |