MatcherWords

object MatcherWords extends MatcherWords
Companion:
class
class Object
trait Matchable
class Any

Value members

Inherited methods

def equal(right: Any): MatcherFactory1[Any, Equality]

This method enables the following syntax:

This method enables the following syntax:

result should equal (7)
             ^

The left should equal (right) syntax works by calling == on the left value, passing in the right value, on every type except arrays. If both left and right are arrays, deep will be invoked on both left and right before comparing them with ==. Thus, even though this expression will yield false, because Array's equals method compares object identity:

Array(1, 2) == Array(1, 2) // yields false

The following expression will not result in a TestFailedException, because ScalaTest will compare the two arrays structurally, taking into consideration the equality of the array's contents:

Array(1, 2) should equal (Array(1, 2)) // succeeds (i.e., does not throw TestFailedException)

If you ever do want to verify that two arrays are actually the same object (have the same identity), you can use the be theSameInstanceAs syntax.

Inherited from:
MatcherWords
def noException(implicit pos: Position): NoExceptionWord

This field enables the following syntax:

This field enables the following syntax:

noException should be thrownBy
^
Inherited from:
MatcherWords

Inherited fields

val be: BeWord

This field enables syntax such as the following:

This field enables syntax such as the following:

obj should (be theSameInstanceAs (string) and be theSameInstanceAs (string))
           ^
Inherited from:
MatcherWords
val compile: CompileWord

This field enables the following syntax:

This field enables the following syntax:


"val a: String = 1" shouldNot compile
                             ^
Inherited from:
MatcherWords

This field enables syntax such as the following:

This field enables syntax such as the following:

list should (contain ('a') and have length (7))
            ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:

seq should be (defined)
             ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:


list should be (empty)
               ^
Inherited from:
MatcherWords

This field enables syntax such as the following:

This field enables syntax such as the following:

string should (endWith ("ago") and include ("score"))
              ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:

file should exist
           ^
Inherited from:
MatcherWords

This field enables syntax such as the following:

This field enables syntax such as the following:

string should (fullyMatch regex ("Hel*o, wor.d") and not have length (99))
              ^
Inherited from:
MatcherWords

This field enables syntax such as the following:

This field enables syntax such as the following:

list should (have length (3) and not contain ('a'))
            ^
Inherited from:
MatcherWords

This field enables syntax such as the following:

This field enables syntax such as the following:

string should (include ("hope") and not startWith ("no"))
              ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:

"hi" should not have length (3)
                    ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:


result should matchPattern { case Person("Bob", _) => }
             ^
Inherited from:
MatcherWords

This field enables syntax like the following:

This field enables syntax like the following:

myFile should (not be an (directory) and not have ('name ("foo.bar")))
              ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:


file should be (readable)
               ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:

set should not have size (3)
                   ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:

seq should be (sorted)
             ^
Inherited from:
MatcherWords

This field enables syntax such as the following:

This field enables syntax such as the following:

string should (startWith ("Four") and include ("year"))
              ^
Inherited from:
MatcherWords
val typeCheck: TypeCheckWord

This field enables the following syntax:

This field enables the following syntax:


"val a: String = 1" shouldNot typeCheck
                             ^
Inherited from:
MatcherWords

This field enables the following syntax:

This field enables the following syntax:

file should be (writable)
               ^
Inherited from:
MatcherWords