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
behavefield ofFunSpecs,FlatSpecs, andWordSpecs 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
behavefield ofFunSpecs,FlatSpecs, andWordSpecs as well as instance of their sister traits,fixture.FunSpec,fixture.FlatSpec, andfixture.WordSpec.This class, via the
behavefield, enables syntax such as the following inFunSpecs,FlatSpecs,fixture.FunSpecs, andfixture.FlatSpecs:it should behave like nonFullStack(stackWithOneItem) ^It also enables syntax such as the following syntax in
WordSpecs andfixture.WordSpecs: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
canmethods toStringto support the syntax ofFlatSpec,WordSpec,org.scalatest.fixture.FlatSpec, andfixture.WordSpec.Provides an implicit conversion that adds
canmethods toStringto support the syntax ofFlatSpec,WordSpec,org.scalatest.fixture.FlatSpec, andfixture.WordSpec.For example, this trait enables syntax such as the following test registration in
FlatSpecandfixture.FlatSpec:"A Stack (when empty)" can "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in
FlatSpecandfixture.FlatSpec:"A Stack (with one item)" can behave like nonEmptyStack(stackWithOneItem, lastValuePushed) ^In addition, it supports the registration of subject descriptions in
WordSpecandfixture.WordSpec, such as:"A Stack (when empty)" can { ... ^And finally, it also supportds the registration of subject descriptions with after words in
WordSpecandfixture.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 withShouldVerbandMustVerb. BothShouldVerbandMustVerbmust exist as a separate trait because an implicit conversion provided directly would conflict with the implicit conversion that providesshouldormustmethods onStringin theMatchersandMustMatcherstraits. - 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
Matchersfor an overview of the matchers DSL. - trait MustVerb extends AnyRef
Provides an implicit conversion that adds
mustmethods toStringto support the syntax ofFlatSpec,WordSpec,fixture.FlatSpec, andfixture.WordSpec.Provides an implicit conversion that adds
mustmethods toStringto support the syntax ofFlatSpec,WordSpec,fixture.FlatSpec, andfixture.WordSpec.For example, this trait enables syntax such as the following test registration in
FlatSpecandfixture.FlatSpec:"A Stack (when empty)" must "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in
FlatSpecandfixture.FlatSpec:"A Stack (with one item)" must behave like nonEmptyStack(stackWithOneItem, lastValuePushed) ^In addition, it supports the registration of subject descriptions in
WordSpecandfixture.WordSpec, such as:"A Stack (when empty)" must { ... ^And finally, it also supportds the registration of subject descriptions with after words in
WordSpecandfixture.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 providesmustmethods onStringin theMustMatcherstrait. By contrast, there is no conflict with the separateMustVerbtrait approach, because:FlatSpec,WordSpec,fixture.FlatSpec, andfixture.WordSpecmix inMustVerbdirectly, andMustMatchersextendsMustVerb, overriding theconvertToStringMustWrapperimplicit conversion function.
So whether or not a
FlatSpec,WordSpec,fixture.FlatSpec, orfixture.WordSpecmixes inMustMatchers, there will only be one implicit conversion in scope that addsmustmethods toStrings.Also, because the class of the result of the overriding
convertToStringMustWrapperimplicit conversion method provided inMustMatchersextends this trait'sStringMustWrapperForVerbclass, the four uses ofmustprovided here are still available. These fourmustare in fact available to any class that mixes inMustMatchers, but each takes an implicit parameter that is provided only inFlatSpecandfixture.FlatSpec, orWordSpecandfixture.WordSpec. - final class ResultOfAfterWordApplication extends AnyRef
Class that supports the use of after words in
WordSpecandfixture.WordSpec.Class that supports the use of after words in
WordSpecandfixture.WordSpec.A
ResultOfAfterWordApplication, which encapsulates the text of the after word and a block, is accepted bywhen,should,must,can, andthatmethods. For more information, see the main documentation for traitWordSpec. - abstract class ResultOfStringPassedToVerb extends AnyRef
Abstract class that supports test registration in
FlatSpecandfixture.FlatSpec.Abstract class that supports test registration in
FlatSpecandfixture.FlatSpec.For example, this class enables syntax such as the following pending test registration in
FlatSpecandfixture.FlatSpec:"A Stack (when empty)" should "be empty" is (pending) ^For example, this class enables syntax such as the following tagged test registration in
FlatSpecandfixture.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
FlatSpecandfixture.FlatSpec:"A Stack (when empty)" should "be empty" in { ... } ^However, this class does not declare any methods named
in, because the type passed toindiffers in aFlatSpecand afixture.FlatSpec. Afixture.FlatSpecneeds twoinmethods, one that takes a no-arg test function and another that takes a one-arg test function (a test that takes aFixtureas its parameter). By constrast, aFlatSpecneeds only oneinmethod that takes a by-name parameter. As a result,FlatSpecandfixture.FlatSpeceach provide an implicit conversion fromResultOfStringPassedToVerbto a type that provides the appropriateinmethods. - abstract class ResultOfTaggedAsInvocation extends AnyRef
Supports the registration of tagged tests in shorthand form in
FlatSpecandfixture.FlatSpec.Supports the registration of tagged tests in shorthand form in
FlatSpecandfixture.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
inandignoremethods directly, these methods are provided aftertaggedAs()by implicit conversions because the type passed toin(andignore) differs in aFlatSpecand afixture.FlatSpec. Afixture.FlatSpecneeds twoinmethods, one that takes a no-arg test function and another that takes a one-arg test function (a test that takes aFixtureas its parameter). By constrast, aFlatSpecneeds only oneinmethod that takes a by-name parameter. As a result,FlatSpecandfixture.FlatSpeceach provide an implicit conversion fromResultOfTaggedAsInvocationto a type that provides the appropriateinmethods. - trait ShouldVerb extends AnyRef
Provides an implicit conversion that adds
shouldmethods toStringto support the syntax ofFlatSpec,WordSpec,fixture.FlatSpec, andfixture.WordSpec.Provides an implicit conversion that adds
shouldmethods toStringto support the syntax ofFlatSpec,WordSpec,fixture.FlatSpec, andfixture.WordSpec.For example, this trait enables syntax such as the following test registration in
FlatSpecandfixture.FlatSpec:"A Stack (when empty)" should "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in
FlatSpecandfixture.FlatSpec:"A Stack (with one item)" should behave like nonEmptyStack(stackWithOneItem, lastValuePushed) ^In addition, it supports the registration of subject descriptions in
WordSpecandfixture.WordSpec, such as:"A Stack (when empty)" should { ... ^And finally, it also supportds the registration of subject descriptions with after words in
WordSpecandfixture.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 providesshouldmethods onStringin theMatcherstrait. By contrast, there is no conflict with the separateShouldVerbtrait approach, because:FlatSpec,WordSpec,fixture.FlatSpec, andfixture.WordSpecmix inShouldVerbdirectly, andMatchersextendsShouldVerb, overriding theconvertToStringShouldWrapperimplicit conversion function.
So whether or not a
FlatSpec,WordSpec,fixture.FlatSpec, orfixture.WordSpecmixes inMatchers, there will only be one implicit conversion in scope that addsshouldmethods toStrings.Also, because the class of the result of the overriding
convertToStringShouldWrapperimplicit conversion method provided inMatchersextends this trait'sStringShouldWrapperForVerbclass, the four uses ofshouldprovided here are still available. These fourshouldare in fact available to any class that mixes inMatchers, but each takes an implicit parameter that is provided only inFlatSpecandfixture.FlatSpec, orWordSpecandfixture.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
FlatSpecandFreeSpecstyles.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpecandFreeSpecstyles.For example, this class enables syntax such as the following in
WordSpecandfixture.WordSpec:"A Stack (when empty)" should { ... ^This
shouldmethod, 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
WordSpecandfixture.WordSpec.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
WordSpecandfixture.WordSpec.For example, this class enables syntax such as the following in
WordSpecandfixture.WordSpec:"A Stack (when empty)" should { ... ^This
shouldmethod, 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
FlatSpecandFreeSpecstyles.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpecandFreeSpecstyles.For example, this class enables syntax such as the following in
WordSpecandfixture.WordSpec:"A Stack (when empty)" should { ... ^This
shouldmethod, 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
FlatSpecandFreeSpecstyles.Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in
FlatSpecandFreeSpecstyles.For example, this class enables syntax such as the following in
WordSpecandfixture.WordSpec:"A Stack (when empty)" should { ... ^This
shouldmethod, 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
Matchersfor an overview of the matchers DSL.