Skip to content

Instantly share code, notes, and snippets.

@leozc
Last active August 29, 2015 14:06
Show Gist options
  • Save leozc/9046dce1756db5b081dd to your computer and use it in GitHub Desktop.
Save leozc/9046dce1756db5b081dd to your computer and use it in GitHub Desktop.
Run ScalaTest From CLI, great for play ground activities
#Example
scala -cp ~/.ivy2//cache/org.scalatest/scalatest_2.10/jars/scalatest_2.10-2.1.5.jar
scala> import org.scalatest._
scala> Seq(1,2,3) must contain (1)
scala> Seq(1,2,3) must contain (5)
org.scalatest.exceptions.TestFailedException: List(1, 2, 3) did not contain element 5
at org.scalatest.MatchersHelper$.newTestFailedException(MatchersHelper.scala:160)
at org.scalatest.MustMatchers$MustMethodHelper$.mustMatcher(MustMatchers.scala:6141)
at org.scalatest.MustMatchers$AnyMustWrapper.must(MustMatchers.scala:6187)
... 33 elided
scala> "hello" must include ("hello")
scala> "hello" must include ("hello1")
org.scalatest.exceptions.TestFailedException: "hello" did not include substring "hello1"
at org.scalatest.MatchersHelper$.newTestFailedException(MatchersHelper.scala:160)
at org.scalatest.MustMatchers$MustMethodHelper$.mustMatcher(MustMatchers.scala:6141)
at org.scalatest.MustMatchers$AnyMustWrapper.must(MustMatchers.scala:6175)
... 33 elided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment