All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.specs2.matcher.StandardMatchResults.scala Maven / Gradle / Ivy

There is a newer version: 3.10.0
Show newest version
package org.specs2
package matcher

import text.Sentences._

/**
 * This trait can be used in conjonction with Pattern matchers:
 *
 * List(1, 2) must be like { case List(a, b) => ok }
 * List(1, 2) must be like { case List(a, b) => ko("unexpected") }
 */
trait StandardMatchResults extends ExpectationsCreation {
  def ok(m: String): MatchResult[Any] =
    checkFailure(Matcher.result(true, m, negateSentence(m), createExpectable(None)))

  def ko(m: String): MatchResult[Any] =
    checkFailure(Matcher.result(false, negateSentence(m), m, createExpectable(None)))

  lazy val ok: MatchResult[Any] =
    checkFailure(Matcher.result(true, "ok", "ko", createExpectable(None)))

  lazy val ko: MatchResult[Any] =
    checkFailure(Matcher.result(false, "ok", "ko", createExpectable(None)))
}

object StandardMatchResults extends StandardMatchResults




© 2015 - 2025 Weber Informatics LLC | Privacy Policy