From e5261645b9b7843c857a1685a436434a0e481cc9 Mon Sep 17 00:00:00 2001 From: Simon Ochsenreither Date: Tue, 30 Jul 2013 18:52:06 +0200 Subject: Add some explicit return types to s.t.c._ --- src/partest/scala/tools/partest/nest/NestUI.scala | 1 - 1 file changed, 1 deletion(-) (limited to 'src/partest') diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala index 5148115905..d063c17ac0 100644 --- a/src/partest/scala/tools/partest/nest/NestUI.scala +++ b/src/partest/scala/tools/partest/nest/NestUI.scala @@ -28,7 +28,6 @@ class Colors(enabled: => Boolean) { object NestUI { private val testNum = new java.util.concurrent.atomic.AtomicInteger(1) @volatile private var testNumberFmt = "%3d" - // @volatile private var testNumber = 1 private def testNumber = testNumberFmt format testNum.getAndIncrement() def resetTestNumber(max: Int = -1) { testNum set 1 -- cgit v1.2.3 From 2b1563fa74e5e5f93b6eac4778fd59b785ac9a8d Mon Sep 17 00:00:00 2001 From: Simon Ochsenreither Date: Tue, 30 Jul 2013 18:53:56 +0200 Subject: Clean up ConsoleRunner, --> returns Boolean ... ... not Unit now. --- src/compiler/scala/tools/cmd/Opt.scala | 6 +++--- src/partest/scala/tools/partest/nest/ConsoleRunner.scala | 7 +------ src/partest/scala/tools/partest/nest/ConsoleRunnerSpec.scala | 10 +++++----- 3 files changed, 9 insertions(+), 14 deletions(-) (limited to 'src/partest') diff --git a/src/compiler/scala/tools/cmd/Opt.scala b/src/compiler/scala/tools/cmd/Opt.scala index 5aee33ec4a..df3d0c4462 100644 --- a/src/compiler/scala/tools/cmd/Opt.scala +++ b/src/compiler/scala/tools/cmd/Opt.scala @@ -29,7 +29,7 @@ object Opt { protected def opt = fromOpt(name) def --? : Boolean // --opt is set - def --> (body: => Unit): Unit // if --opt is set, execute body + def --> (body: => Unit): Boolean // if --opt is set, execute body def --| : Option[String] // --opt is optional, result is Option[String] def --^[T: FromString] : Option[T] // --opt is optional, result is Option[T] @@ -51,7 +51,7 @@ object Opt { import options._ def --? = { addUnary(opt) ; false } - def --> (body: => Unit) = { addUnary(opt) } + def --> (body: => Unit) = { addUnary(opt) ; false } def --| = { addBinary(opt) ; None } def --^[T: FromString] = { addBinary(opt) ; None } @@ -65,7 +65,7 @@ object Opt { class Instance(val programInfo: Info, val parsed: CommandLine, val name: String) extends Implicit with Error { def --? = parsed isSet opt - def --> (body: => Unit) = if (parsed isSet opt) body + def --> (body: => Unit) = { val isSet = parsed isSet opt ; if (isSet) body ; isSet } def --| = parsed get opt def --^[T: FromString] = { val fs = implicitly[FromString[T]] diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index 332131ca3a..371ef43259 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -89,11 +89,6 @@ class ConsoleRunner(argstr: String) extends { } def run(): Unit = { - if (optDebug) NestUI.setDebug() - if (optVerbose) NestUI.setVerbose() - if (optTerse) NestUI.setTerse() - if (optShowDiff) NestUI.setDiffOnFail() - // Early return on no args, version, or invalid args if (optVersion) return echo(versionMsg) if ((argstr == "") || optHelp) return NestUI.usage() @@ -212,7 +207,7 @@ class ConsoleRunner(argstr: String) extends { issueSummaryReport() System exit ( if (isSuccess) 0 else 1 ) } - + run() } diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunnerSpec.scala b/src/partest/scala/tools/partest/nest/ConsoleRunnerSpec.scala index f9143013e9..bb831a4964 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunnerSpec.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunnerSpec.scala @@ -36,11 +36,11 @@ trait ConsoleRunnerSpec extends Spec with Meta.StdOpts with Interpolation { val optSourcePath = "srcpath" / "set (relative) path to test source files (ex.: --srcpath pending)" --| heading("Test output options:") - val optShowDiff = "show-diff" / "show diffs for failed tests" --? - val optVerbose = "verbose" / "show verbose progress information" --? - val optTerse = "terse" / "show terse progress information" --? - val optDebug = "debug" / "enable debugging output" --? - + val optShowDiff = "show-diff" / "show diffs for failed tests" --> NestUI.setDiffOnFail() + val optVerbose = "verbose" / "show verbose progress information" --> NestUI.setVerbose() + val optTerse = "terse" / "show terse progress information" --> NestUI.setTerse() + val optDebug = "debug" / "enable debugging output" --> NestUI.setDebug() + heading("Other options:") val optVersion = "version" / "show Scala version and exit" --? val optSelfTest = "self-test" / "run tests for partest itself" --? -- cgit v1.2.3