summaryrefslogtreecommitdiff
path: root/test/files/run/settings-parse.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/settings-parse.scala')
-rw-r--r--test/files/run/settings-parse.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala
new file mode 100644
index 0000000000..2754feb972
--- /dev/null
+++ b/test/files/run/settings-parse.scala
@@ -0,0 +1,29 @@
+
+import scala.language.postfixOps
+import scala.tools.nsc._
+
+object Test {
+ val tokens = List("", "-deprecation", "foo.scala")
+ val subsets = tokens.toSet.subsets.toList
+ val permutations0 = subsets.flatMap(_.toList.permutations).distinct
+
+ def runWithCp(cp: String) = {
+ val permutations = permutations0 flatMap ("-cp CPTOKEN" :: _ permutations)
+
+ for ((p, i) <- permutations.distinct.sortBy(_ mkString "").zipWithIndex) {
+ val args = p flatMap (_ split "\\s+") map (x => if (x == "CPTOKEN") cp else x)
+ val s = new settings.MutableSettings(println)
+ val (ok, residual) = s.processArguments(args, processAll = true)
+
+ val expected = args filter (_ == "foo.scala")
+ assert(residual == expected, residual)
+ assert(ok, args)
+ println(s"$i) $args ==> $s")
+ }
+ }
+
+ def main(args0: Array[String]): Unit = {
+ runWithCp("")
+ runWithCp("/tmp:/bippy")
+ }
+}