All Downloads are FREE. Search and download functionalities are using the official Maven repository.

specs2.run.scala Maven / Gradle / Ivy

There is a newer version: 5.5.8
Show newest version
package specs2

import org.specs2.main.Arguments
import org.specs2.reporter.LineLogger._
import org.specs2.runner.{Runner, ClassRunner}
import org.specs2.specification.core.{Env, SpecificationStructure}
import org.specs2.fp.syntax._

/**
 * Run a specification from the command-line with specs2.run  
 */
object run extends ClassRunner {

  /**
   * Run one or more specifications with `specs2.run(spec1, spec2)` from a terminal
   */
  def apply(specifications: SpecificationStructure*)(implicit arguments: Arguments = Arguments()) = {
    val env = Env(arguments = arguments, lineLogger = consoleLogger)

    try     Runner.execute(specifications.toList.traverse(report(env)).map(_.suml), arguments, exit = false)(env)
    finally env.shutdown()
  }

  /** main method for the command line */
  def main(args: Array[String]) =
    run(args, exit = true)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy