You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* Asserts the Either value is Either.Right. You can pass in an optional lambda to run additional assertions on the right value
*
* ```
* val name = Either.Right("...")
* assertThat(name).isRight().hasLength(3)
* ```
*/
fun <B : Any> Assert<Either<*, B>>.isRight(): Assert<B> = transform { actual ->
actual.getOrElse { expected("to be right") }
}
/**
* Asserts the Either value is Either.Left. You can pass in an optional lambda to run additional assertions on the left value
*
* ```
* val name = Either.Left("...")
* assertThat(name).isLeft().hasLength(3)
* ```
*/
fun <A : Any> Assert<Either<A, *>>.isLeft(): Assert<A> = transform { actual ->
actual.swap().getOrElse { expected("to be left") }
}
Hmm maybe. It only is useful for people using both of the libraries. At least it should be a separate module in either of the projects to avoid introducing a dependency not all users need.
Activity
evant commentedon Sep 28, 2020
I think this would make sense as a separate lib.
mkotsbak commentedon Sep 29, 2020
Hmm maybe. It only is useful for people using both of the libraries. At least it should be a separate module in either of the projects to avoid introducing a dependency not all users need.