Provides an equality constraint that allows two subtypes of scala.collection.GenMaps to be compared for equality with === so long
as an EqualityConstraint is available for both key types and both value types.
Provides an equality constraint that allows two subtypes of scala.collection.GenMaps to be compared for equality with === so long
as an EqualityConstraint is available for both key types and both value types.
Provides an equality constraint that allows two subtypes of scala.collection.GenSeqs to be compared for equality with === so long
as an EqualityConstraint is available for the element types.
Provides an equality constraint that allows two subtypes of scala.collection.GenSeqs to be compared for equality with === so long
as an EqualityConstraint is available for the element types.
Provides an equality constraint that allows two subtypes of scala.collection.GenSets to be compared for equality with === so long
as an EqualityConstraint is available for the element types.
Provides an equality constraint that allows two subtypes of scala.collection.GenSets to be compared for equality with === so long
as an EqualityConstraint is available for the element types.
Provides three implicit methods that loosen the equality constraint defined by
TypeCheckedTripleEqualsorConversionCheckedTripleEqualsfor ScalaTraversables to one that more closely matches Scala's approach toTraversableequality.Scala's approach to
Traversableequality is that if the objects being compared are ether bothSeqs, bothSets, or bothMaps, the elements are compared to determine equality. This means you could compare an immutableVectorand a mutableListBufferfor equality, for instance, and get true so long as the twoSeqs contained the same elements in the same order. Here's an example:Such a comparison would not, however, compile if you used
===under eitherTypeCheckedTripleEqualsorConversionCheckedTripleEquals, becauseVectorandListBufferare not in a subtype/supertype relationship, nor does an implicit conversion by default exist between them:scala> import org.scalactic._ import org.scalactic._ scala> import TypeCheckedTripleEquals._ import TypeCheckedTripleEquals._ scala> Vector(1, 2) === ListBuffer(1, 2) <console>:16: error: types scala.collection.immutable.Vector[Int] and scala.collection.mutable.ListBuffer[Int] do not adhere to the equality constraint selected for the === and !== operators; the missing implicit parameter is of type org.scalactic.EqualityConstraint[scala.collection.immutable.Vector[Int], scala.collection.mutable.ListBuffer[Int]] Vector(1, 2) === ListBuffer(1, 2) ^If you mix or import the implicit conversion provided by
TraversableEqualityConstraint, however, the comparison will be allowed:The equality constraints provided by this trait require that left and right sides are both subclasses of either
scala.collection.GenSeq,scala.collection.GenSet, orscala.collection.GenMap, and that anEqualityConstraintcan be found for the element types forSeqandSet, or the key and value types forMaps. In the example above, both theVectorandListBufferare subclasses ofscala.collection.GenSeq, and the regularTypeCheckedTripleEqualsprovides equality constraints for the element types, both of which areInt. By contrast, this trait would not allow aVector[Int]to be compared against aListBuffer[java.util.Date], because no equality constraint will exist between the element typesIntandDate:scala> import java.util.Date import java.util.Date scala> Vector(1, 2) === ListBuffer(new Date, new Date) <console>:20: error: types scala.collection.immutable.Vector[Int] and scala.collection.mutable.ListBuffer[java.util.Date] do not adhere to the equality constraint selected for the === and !== operators; the missing implicit parameter is of type org.scalactic.EqualityConstraint[scala.collection.immutable.Vector[Int], scala.collection.mutable.ListBuffer[java.util.Date]] Vector(1, 2) === ListBuffer(new Date, new Date) ^This trait simply mixes together
SeqEqualityConstraints,SetEqualityConstraints, andMapEqualityConstraints.TraversableEqualityConstraints has been deprecated and will be removed in a future version of ScalaTest. You should be able to just remove all mentions of TraversableEqualityConstriants, as the contraints it provided have been added to the Constraint companion object.