I am using scala 2.9.3 and scalatest_2.9.3-1.9.2. I am having trouble using the matchers to assert that a string does NOT contain a substring:
import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers._
class Learning extends FlatSpec {
behavior of "..."
it should "..." in {
val msg = "Upload successful"
msg should include ("successful") // compiles
msg should not include ("error") // does not compile
}
}
Oddly, when I extend org.scalatest.FunSuite
, the compilation error disappears. What's going on?
The compilation error reported is:
[ant:scalac] Learn.scala: error: value include is not a member of org.scalatest.matchers.ShouldMatchers.ResultOfNotWordForLengthWrapper[java.lang.String]
[ant:scalac] serialized should not include ("error")
[ant:scalac] ^
[ant:scalac] one error found