class LegacyCheckingEqualizer[L] extends AnyRef
Class used via an implicit conversion to enable any two objects to be compared with
=== and !== with an Option[String] result and an enforced type constraint between
two object types. For example:
assert(a === b) assert(c !== d)
You can also check numeric values against another with a tolerance. Here are some examples:
assert(a === (2.0 +- 0.1)) assert(c !== (2.0 +- 0.1))
The benefit of using assert(a === b) rather than assert(a == b) in ScalaTest code is
that a TestFailedException produced by the former will include the values of a and b
in its detail message.
Note: This class has "Legacy" in its name because its approach to error messages will eventually be replaced by macros. Once ScalaTest no longer supports Scala 2.9,
this class will be deprecated in favor of class Equalizer. Instead of obtaining nice error messages via the Option[String]
returned by the methods of this class, the error messages will be obtained by a macro. The "legacy" approach to good error messages will continue to be
used, however, until ScalaTest no longer supports Scala 2.9, since macros were introduced to Scala (in experimental form) in 2.10.
The primary constructor takes one object, left, whose type is being converted to Equalizer. The left
value may be a null reference, because this is allowed by Scala's == operator.
- Alphabetic
- By Inheritance
- LegacyCheckingEqualizer
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
LegacyCheckingEqualizer(left: L)
- left
An object to convert to
Equalizer, which represents theleftvalue of a===or!==equality check.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
!==(spread: Spread[L]): Option[String]
Determine whether a numeric object is outside the passed
Spread, returning anOption[String].Determine whether a numeric object is outside the passed
Spread, returning anOption[String].- spread
the
Spreadagainst which to compare the value passed to the constructor asleft- returns
true if the value passed to the constructor as
leftis not within theSpreadpassed to this method. else returns an error message string wrapped in aSome.
-
def
!==[R](right: R)(implicit constraint: Constraint[L, R]): Option[String]
Compare two objects for inequality, returning an
Option[String], using theConstraintinstance passed asconstraint.Compare two objects for inequality, returning an
Option[String], using theConstraintinstance passed asconstraint.- right
the object to compare for inequality with
left, passed to the constructor- constraint
an implicit
Constraintinstance that enforces a relationship between typesLandRand defines a way of calculating equality for objects of typeL- returns
None if the
leftandrightobjects are not equal according to the passedEqualitytype class. else returns an error message string wrapped in aSome.
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
===(spread: Spread[L]): Option[String]
Determine whether a numeric object is within the passed
Spread, returning anOption[String].Determine whether a numeric object is within the passed
Spread, returning anOption[String].- spread
the
Spreadagainst which to compare the value passed to the constructor asleft- returns
None if the value passed to the constructor as
leftis not within theSpreadpassed to this method, else returns an error message string wrapped in aSome.
-
def
===[R](right: R)(implicit constraint: Constraint[L, R]): Option[String]
Compare two objects for equality, returning an
Option[String], using theConstraintinstance passed asconstraint.Compare two objects for equality, returning an
Option[String], using theConstraintinstance passed asconstraint.- right
the object to compare for equality with
left, passed to the constructor- constraint
an implicit
Constraintinstance that enforces a relationship between typesLandRand defines a way of calculating equality for objects of typeL- returns
None if the
leftandrightobjects are equal according to the passedEqualitytype class. else returns an error message string wrapped in aSome.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): 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[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
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( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )