weaver.Expectations$.Helpers
See theHelpers companion object
trait Helpers
Attributes
Members list
Concise view
Type members
Value members
Concrete methods
def exists[L[_], A](la: L[A])(f: A => Expectations)(implicit foldable: Foldable[L], pos: SourceLocation): Expectations
Checks that an assertion is true for at least one element in a foldable. Fails if the foldable is empty.
Checks that an assertion is true for at least one element in a foldable. Fails if the foldable is empty.
Attributes
- Example:
val xs = List("foo", "bar") // success exists(xs)(s => expect.eql("foo", s)
Checks that an assertion is true for all elements in a foldable. Succeeds if the foldable is empty.
Checks that an assertion is true for all elements in a foldable. Succeeds if the foldable is empty.
Attributes
- Example:
val xs = List("foo", "bar") // success forEach(xs)(s => expect.eql(3, s.length)
Alias for forEach
Alias for forEach
Attributes
def matches[A](x: A)(f: PartialFunction[A, Expectations])(implicit pos: SourceLocation, A: Show[A]): Expectations
Checks that a given expression matches a certain pattern; fails otherwise.
Checks that a given expression matches a certain pattern; fails otherwise.
Attributes
- Example:
matches(Option(4)) { case Some(x) => expect.eql(4, x) }
def whenSuccess[F[_], A, E](fa: F[A])(f: A => Expectations)(implicit pos: SourceLocation, F: ApplicativeError[F, E], G: Foldable[F], E: Show[E]): Expectations
Checks that an ApplicativeError
(like Either
) is successful
Checks that an ApplicativeError
(like Either
) is successful
Attributes
- Example:
val res: Either[String, Int] = Right(4) whenSuccess(res) { n => expect.eql(4, n) }