final
case class
LazyArg(arg: Any)(f: (Any) ⇒ String) extends Product with Serializable
Instance Constructors
-
new
LazyArg(arg: Any)(f: (Any) ⇒ String)
Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
val
arg: Any
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from Any
Value Members
-
final
def
asInstanceOf[T0]: T0
-
final
def
isInstanceOf[T0]: Boolean
Ungrouped
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
val
arg: Any
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Transforms a given object's
toStringwith a given function lazily.This class is intended to be used with the
mapResultmethod ofMatcherProducers, which you can use to modify error messages when composing matchers. This class exists to enable those error messages to be modified lazily, so thattoStringis invoked on the givenarg, and its result transformed by the given functionf, only when and if thetoStringmethod is invoked on theLazyArg. As a performance optimization, ScalaTest'sMatchResultavoids invokingtoStringon objects until and unless an error message is actually needed, to minimize unecessary creation and concatenation of strings. TheLazyArgclass enables this same performance optimization when composing matchers.The other design goal of
LazyArgis to make the internalargavailable for inspection in an IDE. In a future version of ScalaTest, theargsofMatchResultthat were used to create the error message will be included in theTestFailedException, so they can be inspected in IDEs. This is why theargfield ofLazyArgis public.For an example of using
LazyArg, see the Composing matchers section in the main documentation for traitMatcher.the argument
a function that given the
argwill produce aString