org.scalautils.TripleEqualsSupport

LegacyEqualizer

class LegacyEqualizer[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 no 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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LegacyEqualizer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LegacyEqualizer(left: L)

    left

    An object to convert to Equalizer, which represents the left value of a === or !== equality check.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. def !==(spread: Spread[L]): Option[String]

    Determine whether a numeric object is outside the passed Spread, returning an Option[String].

    Determine whether a numeric object is outside the passed Spread, returning an Option[String].

    spread

    the Spread against which to compare the value passed to the constructor as left

    returns

    true if the value passed to the constructor as left is not within the Spread passed to this method. else returns an error message string wrapped in a Some.

  4. def !==(right: Any)(implicit equality: Equality[L]): Option[String]

    Compare two objects for inequality, returning an Option[String], using the Equality type class passed as equality.

    Compare two objects for inequality, returning an Option[String], using the Equality type class passed as equality.

    right

    the object to compare for inequality with left, passed to the constructor

    equality

    an implicit Equality type class that defines a way of calculating equality for objects of type L

    returns

    None if the left and right objects are not equal according to the passed Equality type class. else returns an error message string wrapped in a Some.

  5. final def ##(): Int

    Definition Classes
    AnyRef → Any
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. def ===(spread: Spread[L]): Option[String]

    Determine whether a numeric object is within the passed Spread, returning an Option[String].

    Determine whether a numeric object is within the passed Spread, returning an Option[String].

    spread

    the Spread against which to compare the value passed to the constructor as left

    returns

    None if the value passed to the constructor as left is not within the Spread passed to this method, else returns an error message string wrapped in a Some.

  9. def ===(right: Any)(implicit equality: Equality[L]): Option[String]

    Compare two objects for equality, returning an Option[String], using the Equality type class passed as equality.

    Compare two objects for equality, returning an Option[String], using the Equality type class passed as equality.

    right

    the object to compare for equality with left, passed to the constructor

    equality

    an implicit Equality type class that defines a way of calculating equality for objects of type L

    returns

    None if the left and right objects are equal according to the passed Equality type class. else returns an error message string wrapped in a Some.

  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  15. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  17. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any

Ungrouped