Typeclass that enables for sequencing certain contain
syntax in the ScalaTest matchers DSL.
An Sequencing[A]
provides access to the "sequenching nature" of type A
in such
a way that relevant contain
matcher syntax can be used with type A
. An A
can be any type of sequencing—an object that in some way brings together other objects in order.
ScalaTest provides implicit implementations for several types out of the box in the
Sequencing
companion object:
-
scala.collection.GenSeq
-
scala.collection.SortedSet
-
scala.collection.SortedMap
-
Array
-
java.util.List
-
java.util.SortedSet
-
java.util.SortedMap
-
String
The contain
syntax enabled by this trait is:
-
result should contain inOrder (1, 2, 3)
-
result should contain inOrderOnly (1, 2, 3)
-
result should contain theSameElementsInOrderAs List(1, 2, 3)
You can enable the contain
matcher syntax enabled by Sequencing
on your own
type U
by defining an Sequencing[U]
for the type and making it available implicitly.
- Companion:
- object
Value members
Abstract methods
Implements contain
inOrder
syntax for sequences of type S
.
Implements contain
inOrder
syntax for sequences of type S
.
- Value parameters:
- eles
elements all of which should be contained, in order of appearance in
eles
, in the passed sequence- sequence
an sequence about which an assertion is being made
- Returns:
true if the passed sequence contains all of the passed elements in (iteration) order
Implements contain
inOrderOnly
syntax for sequences of type S
.
Implements contain
inOrderOnly
syntax for sequences of type S
.
- Value parameters:
- eles
the only elements that should be contained, in order of appearence in
eles
, in the passed sequence- sequence
an sequence about which an assertion is being made
- Returns:
true if the passed sequence contains only the passed elements in (iteration) order
Implements contain
theSameElementsInOrderAs
syntax for sequences of type S
.
Implements contain
theSameElementsInOrderAs
syntax for sequences of type S
.
- Value parameters:
- leftSequence
an sequence about which an assertion is being made
- rightSequence
an sequence that should contain the same elements, in (iterated) order as the passed
leftSequence
- Returns:
true if the passed
leftSequence
contains the same elements, in (iterated) order, as the passedrightSequence