package verbs
Classes and traits that support ScalaTest DSLs.
This package is released as part of the scalatest-core
module.
- Source
- package.scala
Type Members
- final class BehaveWord extends AnyRef
Class that supports shared test registration via instances referenced from the
behave
field ofFunSpec
s,FlatSpec
s, andWordSpec
s as well as instance of their sister traits,fixture.FunSpec
,fixture.FlatSpec
, andfixture.WordSpec
.Class that supports shared test registration via instances referenced from the
behave
field ofFunSpec
s,FlatSpec
s, andWordSpec
s as well as instance of their sister traits,fixture.FunSpec
,fixture.FlatSpec
, andfixture.WordSpec
.This class, via the
behave
field, enables syntax such as the following inFunSpec
s,FlatSpec
s,fixture.FunSpec
s, andfixture.FlatSpec
s:it should behave like nonFullStack(stackWithOneItem) ^
It also enables syntax such as the following syntax in
WordSpec
s andfixture.WordSpec
s:behave like nonEmptyStack(lastValuePushed) ^
For more information and examples of the use of <cod>behave, see the Shared tests section in the main documentation for trait
FunSpec
,FlatSpec
, orWordSpec
. - trait CanVerb extends AnyRef
Provides an implicit conversion that adds
can
methods toString
to support the syntax ofFlatSpec
,WordSpec
,org.scalatest.fixture.FlatSpec
, andfixture.WordSpec
.Provides an implicit conversion that adds
can
methods toString
to support the syntax ofFlatSpec
,WordSpec
,org.scalatest.fixture.FlatSpec
, andfixture.WordSpec
.For example, this trait enables syntax such as the following test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (when empty)" can "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (with one item)" can behave like nonEmptyStack(stackWithOneItem, lastValuePushed) ^
In addition, it supports the registration of subject descriptions in
WordSpec
andfixture.WordSpec
, such as:"A Stack (when empty)" can { ... ^
And finally, it also supportds the registration of subject descriptions with after words in
WordSpec
andfixture.WordSpec
. For example:def provide = afterWord("provide")
"The ScalaTest Matchers DSL" can provide { ^The reason this implicit conversion is provided in a separate trait, instead of being provided directly in
FlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
, is primarily for design symmetry withShouldVerb
andMustVerb
. BothShouldVerb
andMustVerb
must exist as a separate trait because an implicit conversion provided directly would conflict with the implicit conversion that providesshould
ormust
methods onString
in theMatchers
andMustMatchers
traits. - final class CompileWord extends AnyRef
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for
Matchers
for an overview of the matchers DSL. - trait MustVerb extends AnyRef
Provides an implicit conversion that adds
must
methods toString
to support the syntax ofFlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
.Provides an implicit conversion that adds
must
methods toString
to support the syntax ofFlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
.For example, this trait enables syntax such as the following test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (when empty)" must "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (with one item)" must behave like nonEmptyStack(stackWithOneItem, lastValuePushed) ^
In addition, it supports the registration of subject descriptions in
WordSpec
andfixture.WordSpec
, such as:"A Stack (when empty)" must { ... ^
And finally, it also supportds the registration of subject descriptions with after words in
WordSpec
andfixture.WordSpec
. For example:def provide = afterWord("provide")
"The ScalaTest Matchers DSL" must provide { ^The reason this implicit conversion is provided in a separate trait, instead of being provided directly in
FlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
, is because an implicit conversion provided directly would conflict with the implicit conversion that providesmust
methods onString
in theMustMatchers
trait. By contrast, there is no conflict with the separateMustVerb
trait approach, because:FlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
mix inMustVerb
directly, andMustMatchers
extendsMustVerb
, overriding theconvertToStringMustWrapper
implicit conversion function.
So whether or not a
FlatSpec
,WordSpec
,fixture.FlatSpec
, orfixture.WordSpec
mixes inMustMatchers
, there will only be one implicit conversion in scope that addsmust
methods toString
s.Also, because the class of the result of the overriding
convertToStringMustWrapper
implicit conversion method provided inMustMatchers
extends this trait'sStringMustWrapperForVerb
class, the four uses ofmust
provided here are still available. These fourmust
are in fact available to any class that mixes inMustMatchers
, but each takes an implicit parameter that is provided only inFlatSpec
andfixture.FlatSpec
, orWordSpec
andfixture.WordSpec
. - final class ResultOfAfterWordApplication extends AnyRef
Class that supports the use of after words in
WordSpec
andfixture.WordSpec
.Class that supports the use of after words in
WordSpec
andfixture.WordSpec
.A
ResultOfAfterWordApplication
, which encapsulates the text of the after word and a block, is accepted bywhen
,should
,must
,can
, andthat
methods. For more information, see the main documentation for traitWordSpec
. - abstract class ResultOfStringPassedToVerb extends AnyRef
Abstract class that supports test registration in
FlatSpec
andfixture.FlatSpec
.Abstract class that supports test registration in
FlatSpec
andfixture.FlatSpec
.For example, this class enables syntax such as the following pending test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (when empty)" should "be empty" is (pending) ^
For example, this class enables syntax such as the following tagged test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (when empty)" should "be empty" taggedAs(SlowTet) in { ... } ^
This class also indirectly enables syntax such as the following regular test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (when empty)" should "be empty" in { ... } ^
However, this class does not declare any methods named
in
, because the type passed toin
differs in aFlatSpec
and afixture.FlatSpec
. Afixture.FlatSpec
needs twoin
methods, one that takes a no-arg test function and another that takes a one-arg test function (a test that takes aFixture
as its parameter). By constrast, aFlatSpec
needs only onein
method that takes a by-name parameter. As a result,FlatSpec
andfixture.FlatSpec
each provide an implicit conversion fromResultOfStringPassedToVerb
to a type that provides the appropriatein
methods. - abstract class ResultOfTaggedAsInvocation extends AnyRef
Supports the registration of tagged tests in shorthand form in
FlatSpec
andfixture.FlatSpec
.Supports the registration of tagged tests in shorthand form in
FlatSpec
andfixture.FlatSpec
.For example, this class enables syntax such as the following tagged, pending test registration in shorthand form:
"A Stack (when empty)" should "be empty" taggedAs() is (pending) ^
In addition, this class indirectly enables syntax such as the following tagged test registration in shorthand form:
"A Stack (when empty)" should "be empty" taggedAs() in { ... } ^
Rather than provide
in
andignore
methods directly, these methods are provided aftertaggedAs()
by implicit conversions because the type passed toin
(andignore
) differs in aFlatSpec
and afixture.FlatSpec
. Afixture.FlatSpec
needs twoin
methods, one that takes a no-arg test function and another that takes a one-arg test function (a test that takes aFixture
as its parameter). By constrast, aFlatSpec
needs only onein
method that takes a by-name parameter. As a result,FlatSpec
andfixture.FlatSpec
each provide an implicit conversion fromResultOfTaggedAsInvocation
to a type that provides the appropriatein
methods. - trait ShouldVerb extends AnyRef
Provides an implicit conversion that adds
should
methods toString
to support the syntax ofFlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
.Provides an implicit conversion that adds
should
methods toString
to support the syntax ofFlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
.For example, this trait enables syntax such as the following test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (when empty)" should "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in
FlatSpec
andfixture.FlatSpec
:"A Stack (with one item)" should behave like nonEmptyStack(stackWithOneItem, lastValuePushed) ^
In addition, it supports the registration of subject descriptions in
WordSpec
andfixture.WordSpec
, such as:"A Stack (when empty)" should { ... ^
And finally, it also supportds the registration of subject descriptions with after words in
WordSpec
andfixture.WordSpec
. For example:def provide = afterWord("provide")
"The ScalaTest Matchers DSL" should provide { ^The reason this implicit conversion is provided in a separate trait, instead of being provided directly in
FlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
, is because an implicit conversion provided directly would conflict with the implicit conversion that providesshould
methods onString
in theMatchers
trait. By contrast, there is no conflict with the separateShouldVerb
trait approach, because:FlatSpec
,WordSpec
,fixture.FlatSpec
, andfixture.WordSpec
mix inShouldVerb
directly, andMatchers
extendsShouldVerb
, overriding theconvertToStringShouldWrapper
implicit conversion function.
So whether or not a
FlatSpec
,WordSpec
,fixture.FlatSpec
, orfixture.WordSpec
mixes inMatchers
, there will only be one implicit conversion in scope that addsshould
methods toString
s.Also, because the class of the result of the overriding
convertToStringShouldWrapper
implicit conversion method provided inMatchers
extends this trait'sStringShouldWrapperForVerb
class, the four uses ofshould
provided here are still available. These fourshould
are in fact available to any class that mixes inMatchers
, but each takes an implicit parameter that is provided only inFlatSpec
andfixture.FlatSpec
, orWordSpec
andfixture.WordSpec
. - abstract class StringVerbBehaveLikeInvocation extends AnyRef
Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpec
andFreeSpec
styles.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpec
andFreeSpec
styles.For example, this class enables syntax such as the following in
WordSpec
andfixture.WordSpec
:"A Stack (when empty)" should { ... ^
This
should
method, which is provided inShouldVerb
, needs an implicit parameter of typeStringVerbBlockRegistration
. - abstract class StringVerbBlockRegistration extends AnyRef
Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
WordSpec
andfixture.WordSpec
.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
WordSpec
andfixture.WordSpec
.For example, this class enables syntax such as the following in
WordSpec
andfixture.WordSpec
:"A Stack (when empty)" should { ... ^
This
should
method, which is provided inShouldVerb
, needs an implicit parameter of typeStringVerbBlockRegistration
. - abstract class StringVerbStringInvocation extends AnyRef
Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpec
andFreeSpec
styles.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpec
andFreeSpec
styles.For example, this class enables syntax such as the following in
WordSpec
andfixture.WordSpec
:"A Stack (when empty)" should { ... ^
This
should
method, which is provided inShouldVerb
, needs an implicit parameter of typeStringVerbBlockRegistration
. - abstract class SubjectWithAfterWordRegistration extends AnyRef
Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpec
andFreeSpec
styles.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpec
andFreeSpec
styles.For example, this class enables syntax such as the following in
WordSpec
andfixture.WordSpec
:"A Stack (when empty)" should { ... ^
This
should
method, which is provided inShouldVerb
, needs an implicit parameter of typeStringVerbBlockRegistration
. - final class TypeCheckWord extends AnyRef
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for
Matchers
for an overview of the matchers DSL.