org.specs2.matcher.describe

Type members

Classlikes

class ArrayDiffable[E](using di: Diffable[E]) extends Diffable[Array[E]]
case class ArrayDifference(results: Seq[ComparisonResult], added: Seq[Any], removed: Seq[Any]) extends OrderedCollectionDifferent[Any] with ArrayTypeProvider
case class ArrayIdentical(value: Seq[Any]) extends OrderedCollectionIdentical with ArrayTypeProvider

Render the result of a comparison for different types: primitives, throwables, collections,...

Render the result of a comparison for different types: primitives, throwables, collections,...

The comparison may turn out to render identical values or differences

trait Diffable[T]

Typeclass for values which can be compared and return a comparison result

Typeclass for values which can be compared and return a comparison result

Companion:
object

Note: variance is not managed by having a Diffable typeclass with a contravariant parameter Diffable[-T] In that the implicit for case classes (see product) can not be found.

Note: variance is not managed by having a Diffable typeclass with a contravariant parameter Diffable[-T] In that the implicit for case classes (see product) can not be found.

Instead we deal with variance at the level of each implicit.

For example given exceptionDiffable[T <: Throwable]: Diffable[T] = new ThrowableDiffable[T] will be found for any custom exception extending Throwable. Similarly we can get a diff for RightString, Int and RightString, Int with given eitherDiffable[L: Diffable, R: Diffable, T <: Either[L, R]] because we unify both Rights with Either[String, Int]

Companion:
class
trait Diffables
Companion:
object
object Diffables extends Diffables
Companion:
class
class EitherDiffable[L, R, T <: Either[L, R]] extends Diffable[T]
case class EitherDifferent(changed: ComparisonResult, isRight: Boolean) extends DifferentComparisonResult
case class EitherIdentical(same: ComparisonResult, isRight: Boolean) extends IdenticalComparisonResult
class EitherLeftDiffable[L](using ldi: Diffable[L]) extends Diffable[Left[L, Nothing]]
class EitherRightDiffable[R](using rdi: Diffable[R]) extends Diffable[Right[Nothing, R]]
case class EitherTypeDifferent(isActualRight: Boolean) extends DifferentComparisonResult
class FailureDiffable(using di: Diffable[Throwable]) extends Diffable[Failure[Nothing]]
class FallbackDiffable[T] extends Diffable[T]
case class LinesComparisonResult[T](actual: List[T], expected: List[T])(using evidence$1: Diffable[T]) extends ComparisonResult

Import the implicit Diffable contained in this object to get a colored output showing line differences in Strings containing lots of lines

Import the implicit Diffable contained in this object to get a colored output showing line differences in Strings containing lots of lines

class MapDiffable[K, V, M <: Map[K, V]](using diff: Diffable[V]) extends Diffable[M]
case class MapDifference(same: Seq[(Any, Any)], changed: Seq[(Any, ComparisonResult)], added: Seq[(Any, Any)], removed: Seq[(Any, Any)]) extends UnorderedCollectionDifferent[(Any, Any), (Any, ComparisonResult)] with MapTypeProvider
case class MapIdentical(m: Map[_, _]) extends OrderedCollectionIdentical with MapTypeProvider
object NothingDiffable extends Diffable[Nothing]
class OptionDiffable[T, S <: Option[T]](using evidence$3: Diffable[T], di: Diffable[T]) extends Diffable[S]
class OptionNoneDiffable[T <: Option[Nothing]] extends Diffable[T]
case class OptionTypeDifferent(isActualSome: Boolean, isExpectedSome: Boolean) extends DifferentComparisonResult
abstract class OrderedCollectionDifferent[Element](results: Seq[ComparisonResult], added: Seq[Element], removed: Seq[Element]) extends DifferentComparisonResult
abstract class OrderedCollectionIdentical(value: Iterable[Any]) extends IdenticalComparisonResult
case class OtherDifferent(actual: Any, expected: Any) extends DifferentComparisonResult
case class OtherIdentical(actual: Any, expected: Any) extends IdenticalComparisonResult

Diffable instances for various types

Diffable instances for various types

case class PrimitiveDifference(actual: Any, expected: Any) extends DifferentComparisonResult
case class PrimitiveIdentical(value: Any) extends IdenticalComparisonResult
class ProductComparisonResult(typeName: String, results: List[(String, ComparisonResult)]) extends ComparisonResult
class ProductDiffable[T](typeName: String, product: ProductOf[T], diffables: => List[Diffable[_]]) extends Diffable[T]
class SeqDiffable[E, S <: Seq[E]](using di: Diffable[E]) extends Diffable[S]

This diffable displays elements missing or added from a Seq

This diffable displays elements missing or added from a Seq

case class SeqDifference(result: Seq[ComparisonResult], added: Seq[Any], removed: Seq[Any]) extends OrderedCollectionDifferent[Any] with ListTypeProvider
case class SeqIdentical(value: Seq[Any]) extends OrderedCollectionIdentical with ListTypeProvider
class SeqLinesDiffable[E, S <: Seq[E]](using di: Diffable[E]) extends Diffable[S]

This diffable uses the Lines diffables to show differences between 2 sequences as a unified sequence with inlined differences

This diffable uses the Lines diffables to show differences between 2 sequences as a unified sequence with inlined differences

class SetDiffable[E, S <: Set[E]] extends Diffable[S]
case class SetDifference(same: Seq[Any], added: Seq[Any], removed: Seq[Any]) extends UnorderedCollectionDifferent[Any, Any] with SetTypeProvider
case class SetIdentical(value: Set[_]) extends OrderedCollectionIdentical with SetTypeProvider
case class StackElementDifferent(className: ComparisonResult, methodName: ComparisonResult, fileName: Option[ComparisonResult], lineNumber: ComparisonResult) extends DifferentComparisonResult
case class StackElementIdentical(value: StackTraceElement) extends IdenticalComparisonResult
class StackTraceElementDiffable(using nameDiffable: Diffable[String], lineDiffable: Diffable[Int]) extends Diffable[StackTraceElement]
class ThrowableDiffable[T <: Throwable](using sdi: Diffable[String], adi: Diffable[List[StackTraceElement]]) extends Diffable[T]
case class ThrowableIdentical(value: Throwable) extends IdenticalComparisonResult
class TryDiffable[T, S <: Try[T]](using evidence$4: Diffable[T], tdi: Diffable[Throwable]) extends Diffable[S]
case class TryDifferent(value: ComparisonResult, isSuccess: Boolean) extends DifferentComparisonResult
case class TryIdentical(same: Any, isSuccess: Boolean) extends IdenticalComparisonResult
case class TryTypeDifferent(isActualSuccess: Boolean) extends DifferentComparisonResult
abstract class UnorderedCollectionDifferent[Element, Change](same: Seq[Element], changed: Seq[Change], added: Seq[Element], removed: Seq[Element]) extends DifferentComparisonResult