final class StringShouldWrapper extends AnyShouldWrapper[String] with StringShouldWrapperForVerb
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is used in conjunction with an implicit conversion to enable should
methods to
be invoked on String
s.
- Source
- Matchers.scala
- Alphabetic
- By Inheritance
- StringShouldWrapper
- StringShouldWrapperForVerb
- AnyShouldWrapper
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new StringShouldWrapper(leftSideString: String, pos: Position, prettifier: Prettifier)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val leftSideString: String
- Definition Classes
- StringShouldWrapper → StringShouldWrapperForVerb
- val leftSideValue: String
- Definition Classes
- AnyShouldWrapper
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val pos: Position
- Definition Classes
- AnyShouldWrapper
- val prettifier: Prettifier
- Definition Classes
- AnyShouldWrapper
- macro def should(compileWord: CompileWord)(implicit pos: Position): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
string should compile ^
- def should(fullyMatchWord: FullyMatchWord): ResultOfFullyMatchWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string should fullyMatch regex ("""(-)?(\d+)(\.\d*)?""") ^
- def should(resultOfAfterWordApplication: ResultOfAfterWordApplication)(implicit swawr: SubjectWithAfterWordRegistration): Unit
Supports the registration of subject descriptions with after words in
WordSpec
andfixture.WordSpec
.Supports the registration of subject descriptions with after words in
WordSpec
andfixture.WordSpec
.For example, this method enables syntax such as the following in
WordSpec
andfixture.WordSpec
:def provide = afterWord("provide")
"The ScalaTest Matchers DSL" should provide { ^WordSpec
passes in a function via the implicit parameter that takes two strings and aResultOfAfterWordApplication
and results inUnit
. This method simply invokes this function, passing in leftSideString, the verb string"should"
, and theResultOfAfterWordApplication
passed toshould
.- Definition Classes
- StringShouldWrapperForVerb
- def should(right: => Unit)(implicit fun: StringVerbBlockRegistration): Unit
Supports the registration of subject descriptions in
WordSpec
andfixture.WordSpec
.Supports the registration of subject descriptions in
WordSpec
andfixture.WordSpec
.For example, this method enables syntax such as the following in
WordSpec
andfixture.WordSpec
:"A Stack (when empty)" should { ... ^
WordSpec
passes in a function via the implicit parameter of typeStringVerbBlockRegistration
, a function that takes two strings and a no-arg function and results inUnit
. This method simply invokes this function, passing in leftSideString, the verb string"should"
, and the right by-name parameter transformed into a no-arg function.- Definition Classes
- StringShouldWrapperForVerb
- def should(right: BehaveWord)(implicit svbli: StringVerbBehaveLikeInvocation): BehaveWord
Supports shared test registration in
FlatSpec
andfixture.FlatSpec
.Supports shared test registration in
FlatSpec
andfixture.FlatSpec
.For example, this method enables syntax such as the following in
FlatSpec
andfixture.FlatSpec
:"A Stack (with one item)" should behave like nonEmptyStack(stackWithOneItem, lastValuePushed) ^
FlatSpec
andfixture.FlatSpec
passes in a function via the implicit parameter that takes a string and results in aBehaveWord
. This method simply invokes this function, passing in leftSideString, and returns the result.- Definition Classes
- StringShouldWrapperForVerb
- def should(right: String)(implicit svsi: StringVerbStringInvocation): ResultOfStringPassedToVerb
Supports test registration in
FlatSpec
andfixture.FlatSpec
.Supports test registration in
FlatSpec
andfixture.FlatSpec
.For example, this method enables syntax such as the following in
FlatSpec
andfixture.FlatSpec
:"A Stack (when empty)" should "be empty" in { ... } ^
FlatSpec
passes in a StringVerbStringInvocation via the implicit parameter that takes three strings and results in aResultOfStringPassedToVerb
. This method simply invokes this function, passing in leftSideString, the verb string"should"
, and right, and returns the result.- Definition Classes
- StringShouldWrapperForVerb
- def should(endWithWord: EndWithWord)(implicit ev: <:<[String, String]): ResultOfEndWithWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string should endWith regex ("world") ^
- Definition Classes
- AnyShouldWrapper
- def should(startWithWord: StartWithWord)(implicit ev: <:<[String, String]): ResultOfStartWithWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string should startWith regex ("hello") ^
- Definition Classes
- AnyShouldWrapper
- def should(includeWord: IncludeWord)(implicit ev: <:<[String, String]): ResultOfIncludeWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string should include regex ("hi") ^
- Definition Classes
- AnyShouldWrapper
- def should(notExist: ResultOfNotExist)(implicit existence: Existence[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
file should not (exist) ^
- Definition Classes
- AnyShouldWrapper
- def should(existWord: ExistWord)(implicit existence: Existence[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
file should exist ^
- Definition Classes
- AnyShouldWrapper
- def should(containWord: ContainWord): ResultOfContainWord[String]
This method enables syntax such as the following:
This method enables syntax such as the following:
xs should contain oneOf (1, 2, 3) ^
- Definition Classes
- AnyShouldWrapper
- def should(haveWord: HaveWord): ResultOfHaveWordForExtent[String]
This method enables syntax such as the following:
This method enables syntax such as the following:
result should have length (3) ^ result should have size (3) ^
- Definition Classes
- AnyShouldWrapper
- def should(beWord: BeWord): ResultOfBeWordForAny[String]
This method enables syntax such as the following:
This method enables syntax such as the following:
result should be a aMatcher ^
- Definition Classes
- AnyShouldWrapper
- def should(inv: TripleEqualsInvocationOnSpread[String])(implicit ev: Numeric[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result should === (100 +- 1) ^
- Definition Classes
- AnyShouldWrapper
- def should[U](inv: TripleEqualsInvocation[U])(implicit constraint: CanEqual[String, U]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
a should === (b) ^
- Definition Classes
- AnyShouldWrapper
- def should(notWord: NotWord): ResultOfNotWordForAny[String]
This method enables syntax such as the following:
This method enables syntax such as the following:
result should not equal (3) ^
- Definition Classes
- AnyShouldWrapper
- def should[TYPECLASS1[_], TYPECLASS2[_]](rightMatcherFactory2: MatcherFactory2[String, TYPECLASS1, TYPECLASS2])(implicit typeClass1: TYPECLASS1[String], typeClass2: TYPECLASS2[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result should (equal (expected) and have length 3) ^
- Definition Classes
- AnyShouldWrapper
- def should[TYPECLASS1[_]](rightMatcherFactory1: MatcherFactory1[String, TYPECLASS1])(implicit typeClass1: TYPECLASS1[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result should equal (3) ^
- Definition Classes
- AnyShouldWrapper
- def should(rightMatcherX1: Matcher[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result should be (3) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe[U >: String](resultOfAnWordApplication: ResultOfAnWordToBePropertyMatcherApplication[U])(implicit ev: <:<[String, AnyRef]): Assertion
This method enables the following syntax, where
excellentRead
refers to aBePropertyMatcher[Book]
:This method enables the following syntax, where
excellentRead
refers to aBePropertyMatcher[Book]
:programmingInScala shouldBe an (excellentRead) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe[U >: String](resultOfAWordApplication: ResultOfAWordToBePropertyMatcherApplication[U])(implicit ev: <:<[String, AnyRef]): Assertion
This method enables the following syntax, where
goodRead
refers to aBePropertyMatcher[Book]
:This method enables the following syntax, where
goodRead
refers to aBePropertyMatcher[Book]
:programmingInScala shouldBe a (goodRead) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(bePropertyMatcher: BePropertyMatcher[String])(implicit ev: <:<[String, AnyRef]): Assertion
This method enables the following syntax, where
excellentRead
refers to aBePropertyMatcher[Book]
:This method enables the following syntax, where
excellentRead
refers to aBePropertyMatcher[Book]
:programmingInScala shouldBe excellentRead ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(resultOfAnWordApplication: ResultOfAnWordToSymbolApplication)(implicit toAnyRef: <:<[String, AnyRef]): Assertion
This method enables the following syntax:
This method enables the following syntax:
list shouldBe an ('empty) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(resultOfAWordApplication: ResultOfAWordToSymbolApplication)(implicit toAnyRef: <:<[String, AnyRef]): Assertion
This method enables the following syntax:
This method enables the following syntax:
list shouldBe a ('empty) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(symbol: Symbol)(implicit toAnyRef: <:<[String, AnyRef]): Assertion
This method enables the following syntax:
This method enables the following syntax:
list shouldBe 'empty ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(resultOfSameInstanceAsApplication: ResultOfTheSameInstanceAsApplication)(implicit toAnyRef: <:<[String, AnyRef]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe theSameInstanceAs (anotherObject) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(right: Null)(implicit ev: <:<[String, AnyRef]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe null ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(right: DefinedWord)(implicit definition: Definition[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe defined ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(right: EmptyWord)(implicit emptiness: Emptiness[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe empty ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(right: WritableWord)(implicit writability: Writability[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe writable ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(right: ReadableWord)(implicit readability: Readability[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe readable ^
- Definition Classes
- AnyShouldWrapper
- macro def shouldBe(anType: ResultOfAnTypeInvocation[_]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
aDouble shouldBe an [Book] ^
- Definition Classes
- AnyShouldWrapper
- macro def shouldBe(aType: ResultOfATypeInvocation[_]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
aDouble shouldBe a [Book] ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(right: SortedWord)(implicit sortable: Sortable[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe sorted ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(spread: Spread[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldBe 7.1 +- 0.2 ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(beMatcher: BeMatcher[String]): Assertion
This method enables the following syntax, where
odd
refers to aBeMatcher[Int]
:This method enables the following syntax, where
odd
refers to aBeMatcher[Int]
:testing 1 shouldBe odd ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(comparison: ResultOfGreaterThanOrEqualToComparison[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
8 shouldBe >= (7) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(comparison: ResultOfLessThanOrEqualToComparison[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
5 shouldBe <= (7) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(comparison: ResultOfGreaterThanComparison[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
8 shouldBe > (7) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(comparison: ResultOfLessThanComparison[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
5 shouldBe < (7) ^
- Definition Classes
- AnyShouldWrapper
- def shouldBe(right: Any): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
aDouble shouldBe 8.8 ^
- Definition Classes
- AnyShouldWrapper
- def shouldEqual(right: Null)(implicit ev: <:<[String, AnyRef]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldEqual null ^
- Definition Classes
- AnyShouldWrapper
- def shouldEqual(spread: Spread[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldEqual 7.1 +- 0.2 ^
- Definition Classes
- AnyShouldWrapper
- def shouldEqual(right: Any)(implicit equality: Equality[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
a shouldEqual b ^
- Definition Classes
- AnyShouldWrapper
- macro def shouldNot(typeCheckWord: TypeCheckWord)(implicit pos: Position): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
string shouldNot typeCheck ^
- macro def shouldNot(compileWord: CompileWord)(implicit pos: Position): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
string shouldNot compile ^
- def shouldNot(fullyMatchWord: FullyMatchWord): ResultOfFullyMatchWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string shouldNot fullyMatch regex ("""(-)?(\d+)(\.\d*)?""") ^
- def shouldNot(includeWord: IncludeWord)(implicit ev: <:<[String, String]): ResultOfIncludeWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string shouldNot include regex ("hi") ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot(endWithWord: EndWithWord)(implicit ev: <:<[String, String]): ResultOfEndWithWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string shouldNot endWith regex ("world") ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot(startWithWord: StartWithWord)(implicit ev: <:<[String, String]): ResultOfStartWithWordForString
This method enables syntax such as the following:
This method enables syntax such as the following:
string shouldNot startWith regex ("hello") ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot(existWord: ExistWord)(implicit existence: Existence[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
file shouldNot exist ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot(contain: ContainWord): ResultOfContainWord[String]
This method enables syntax such as the following:
This method enables syntax such as the following:
xs shouldNot contain (oneOf (1, 2, 3)) ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot(haveWord: HaveWord): ResultOfHaveWordForExtent[String]
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldNot have length (3) ^ result shouldNot have size (3) ^ exception shouldNot have message ("file not found") ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot[TYPECLASS1[_]](rightMatcherFactory1: MatcherFactory1[String, TYPECLASS1])(implicit typeClass1: TYPECLASS1[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldNot (be readable) ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot(rightMatcherX1: Matcher[String]): Assertion
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldNot (be (3)) ^
- Definition Classes
- AnyShouldWrapper
- def shouldNot(beWord: BeWord): ResultOfBeWordForAny[String]
This method enables syntax such as the following:
This method enables syntax such as the following:
result shouldNot be (3) ^
- Definition Classes
- AnyShouldWrapper
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withGroup(group: String): RegexWithGroups
This method enables syntax such as the following:
This method enables syntax such as the following:
string should fullyMatch regex ("a(b*)c" withGroup "bb") ^
- def withGroups(groups: String*): RegexWithGroups
This method enables syntax such as the following:
This method enables syntax such as the following:
string should fullyMatch regex ("a(b*)(c*)" withGroups ("bb", "cc")) ^