aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-02-28 11:49:32 -0600
committerJesse Luehrs <doy@tozt.net>2013-02-28 13:08:27 -0600
commitb4fe705aa6fd74b34ea1de457a981a31b0a941c0 (patch)
tree9233e35a62e22175903f7531a1229eb12c632109 /src
parenta908ee5ea0933a1841acf7a96ed37ff73568b26e (diff)
downloadscala-test-more-b4fe705aa6fd74b34ea1de457a981a31b0a941c0.tar.gz
scala-test-more-b4fe705aa6fd74b34ea1de457a981a31b0a941c0.zip
more cleanup
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/org/perl8/test/harness/TestHarness.scala32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/main/scala/org/perl8/test/harness/TestHarness.scala b/src/main/scala/org/perl8/test/harness/TestHarness.scala
index 09f780b..cd77901 100644
--- a/src/main/scala/org/perl8/test/harness/TestHarness.scala
+++ b/src/main/scala/org/perl8/test/harness/TestHarness.scala
@@ -5,25 +5,32 @@ object TestHarness {
def main (args: Array[String]) {
val opts = parseOpts(args.toList)
- val multi = !opts("prefer-single").asInstanceOf[Boolean]
+ val single = opts("prefer-single").asInstanceOf[Boolean]
- val exitCode = if (multi) {
- val reporterName = opts("multi-reporter").asInstanceOf[String]
- val testNames = opts("test-classes").asInstanceOf[List[String]]
- val reporter = newInstance[MultiTestReporter](reporterName)
- reporter.run(testNames)
- }
- else {
+ val exitCode = if (single) {
val reporterName = opts("single-reporter").asInstanceOf[String]
val testName = opts("test-classes").asInstanceOf[List[String]].apply(0)
val reporter = newInstance[Reporter](reporterName)
reporter.run(testName)
}
+ else {
+ val reporterName = opts("multi-reporter").asInstanceOf[String]
+ val testNames = opts("test-classes").asInstanceOf[List[String]]
+ val reporter = newInstance[MultiTestReporter](reporterName)
+ reporter.run(testNames)
+ }
sys.exit(exitCode)
}
def parseOpts (args: List[String]): Map[String, Any] = args match {
+ case Nil => Map(
+ "single-reporter" -> "org.perl8.test.harness.TAPReporter",
+ "multi-reporter" -> "org.perl8.test.harness.SummaryReporter",
+ "prefer-single" -> true,
+ "test-classes" -> Nil
+ )
+
case "-r" :: singleReporter :: rest =>
parseOpts(rest) + ("single-reporter" -> singleReporter)
@@ -36,14 +43,7 @@ object TestHarness {
case "--help" :: rest =>
usage(0)
- case Nil => Map(
- "single-reporter" -> "org.perl8.test.harness.TAPReporter",
- "multi-reporter" -> "org.perl8.test.harness.SummaryReporter",
- "prefer-single" -> true,
- "test-classes" -> Nil
- )
-
- case `unknownOption` =>
+ case `unknownOption` :: rest =>
usage(1)
case testClass :: rest => {