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
toString
with a given function lazily.This class is intended to be used with the
mapResult
method 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 thattoString
is invoked on the givenarg
, and its result transformed by the given functionf
, only when and if thetoString
method is invoked on theLazyArg
. As a performance optimization, ScalaTest'sMatchResult
avoids invokingtoString
on objects until and unless an error message is actually needed, to minimize unecessary creation and concatenation of strings. TheLazyArg
class enables this same performance optimization when composing matchers.The other design goal of
LazyArg
is to make the internalarg
available for inspection in an IDE. In a future version of ScalaTest, theargs
ofMatchResult
that were used to create the error message will be included in theTestFailedException
, so they can be inspected in IDEs. This is why thearg
field ofLazyArg
is 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
arg
will produce aString