Skip to content

Instantly share code, notes, and snippets.

@bvenners
Created September 16, 2014 00:28
Show Gist options
  • Save bvenners/f038d946adab18b9cb78 to your computer and use it in GitHub Desktop.
Save bvenners/f038d946adab18b9cb78 to your computer and use it in GitHub Desktop.
Type checked contain matcher coming in ScalaTest 3.0
> console
[info] Compiling 1 Scala source to /Users/bv/nobkp/delus/redlady/target/scala-2.11/classes...
[info] Starting scala interpreter...
[info]
import org.scalatest._
import org.scalactic._
import Matchers._
Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.
scala> "all your base are belong to us" should contain ("base")
org.scalatest.exceptions.TestFailedException: "all your base are belong to us" did not contain element "base"
at org.scalatest.MatchersHelper$.newTestFailedException(MatchersHelper.scala:160)
at org.scalatest.Matchers$ShouldMethodHelper$.shouldMatcher(Matchers.scala:6808)
at org.scalatest.Matchers$AnyShouldWrapper.should(Matchers.scala:6854)
... 43 elided
scala> import CheckedEquality._
import CheckedEquality._
scala> "all your base are belong to us" should contain ("base")
<console>:20: error: could not find implicit value for parameter typeClass1:
org.scalactic.enablers.EvidenceThat[String]#CanBeContainedIn[String]
"all your base are belong to us" should contain ("base")
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment