Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created October 12, 2019 20:44
Show Gist options
  • Save etorreborre/7d9077698f162626e6bb7c70aad4effe to your computer and use it in GitHub Desktop.
Save etorreborre/7d9077698f162626e6bb7c70aad4effe to your computer and use it in GitHub Desktop.
Specs2 command line arguments
import org.specs2.main.CommandLine
// run from sbt with
//
// sbt> testOnly *ArgsSpec*
// sbt> testOnly *ArgsSpec* -- isOk
// sbt> testOnly *ArgsSpec* -- !isOk
//
// and see the difference
class ArgsSpec(args: CommandLine) extends mutable.Specification {
"This example is controlled from the command line" in {
if (args.isSet("isOk")) 1 must_== 1
else 1 must_== 2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment