This field enables syntax such as the following:
This field enables syntax such as the following:
obj will (be theSameInstanceAs (string) and be theSameInstanceAs (string)) ^
This field enables the following syntax:
This field enables the following syntax:
"val a: String = 1" willNot compile ^
This field enables syntax such as the following:
This field enables syntax such as the following:
list will (contain ('a') and have length (7)) ^
This field enables the following syntax:
This field enables the following syntax:
seq will be (defined) ^
This field enables the following syntax:
This field enables the following syntax:
list will be (empty) ^
This field enables syntax such as the following:
This field enables syntax such as the following:
string will (endWith ("ago") and include ("score")) ^
This method enables the following syntax:
This method enables the following syntax:
result will equal (7) ^
The left will 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) will 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.
This field enables the following syntax:
This field enables the following syntax:
file will exist ^
This field enables syntax such as the following:
This field enables syntax such as the following:
string will (fullyMatch regex ("Hel*o, wor.d") and not have length (99)) ^
This field enables syntax such as the following:
This field enables syntax such as the following:
list will (have length (3) and not contain ('a')) ^
This field enables syntax such as the following:
This field enables syntax such as the following:
string will (include ("hope") and not startWith ("no")) ^
This field enables the following syntax:
This field enables the following syntax:
"hi" will not have length (3) ^
This field enables the following syntax:
This field enables the following syntax:
result will matchPattern { case Person("Bob", _) => } ^
This field enables the following syntax:
This field enables the following syntax:
noException will be thrownBy ^
This field enables syntax like the following:
This field enables syntax like the following:
myFile will (not be an (directory) and not have ('name ("foo.bar"))) ^
This field enables the following syntax:
This field enables the following syntax:
file will be (readable) ^
This field enables the following syntax:
This field enables the following syntax:
set will not have size (3) ^
This field enables the following syntax:
This field enables the following syntax:
seq will be (sorted) ^
This field enables syntax such as the following:
This field enables syntax such as the following:
string will (startWith ("Four") and include ("year")) ^
This field enables the following syntax:
This field enables the following syntax:
"val a: String = 1" willNot typeCheck ^
This field enables the following syntax:
This field enables the following syntax:
file will be (writable) ^