diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-02-17 18:54:46 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-02-17 21:30:51 +0100 |
commit | 0538e7fd086c39226b2d005865eee07bb83f5b2e (patch) | |
tree | ce981a3175ee5ef92e3705a3ca728129c079ab3f /test/junit | |
parent | 55549bfa41f4a19c9556b71791de35875e8229dc (diff) | |
download | scala-0538e7fd086c39226b2d005865eee07bb83f5b2e.tar.gz scala-0538e7fd086c39226b2d005865eee07bb83f5b2e.tar.bz2 scala-0538e7fd086c39226b2d005865eee07bb83f5b2e.zip |
Group settings should honor user-set individual options
In the last commit, we added the ability to explicitly disable
boolean settings form the command line.
This commit changes group settings (like -optimize), to leave
them alone if set explicitly.
Examples:
`scalac -Xlint -Ywarn-unused:false -optimize -Yinline:false`
The mechanism for such settings has also been refactored to
`MutableSettings`, to let use reuse this for `-Xlint`.
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/settings/SettingsTest.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala index 4b0e58ff79..e4b5ecc7c3 100644 --- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala +++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala @@ -25,4 +25,28 @@ class SettingsTest { assertFalse(check("-Ytest-setting:FALSE").value) assertThrows[IllegalArgumentException](check("-Ytest-setting:rubbish")) } + + @Test def userSettingsHavePredecenceOverOptimize() { + def check(args: String*): MutableSettings#BooleanSetting = { + val s = new MutableSettings(msg => throw new IllegalArgumentException(msg)) + val (ok, residual) = s.processArguments(args.toList, processAll = true) + assert(residual.isEmpty) + s.inline // among -optimize + } + assertTrue(check("-optimise").value) + assertFalse(check("-optimise", "-Yinline:false").value) + assertFalse(check("-Yinline:false", "-optimise").value) + } + + @Test def userSettingsHavePredecenceOverLint() { + def check(args: String*): MutableSettings#BooleanSetting = { + val s = new MutableSettings(msg => throw new IllegalArgumentException(msg)) + val (ok, residual) = s.processArguments(args.toList, processAll = true) + assert(residual.isEmpty) + s.warnAdaptedArgs // among Xlint + } + assertTrue(check("-Xlint").value) + assertFalse(check("-Xlint", "-Ywarn-adapted-args:false").value) + assertFalse(check("-Ywarn-adapted-args:false", "-Xlint").value) + } } |