An opinionated helper trait for combinator specifications.
An opinionated helper trait for combinator specifications. The recommended practice for defining new combinators
is test-first via this specification:
class MyCombinatorSpec extends AnyWordSpec with ResultMatchers with Matchers {
def isMonotonous[ T ]: Validator[ Iterable[ T ] ] = ???
"isMonotonous" should {
"successfully validate a monotonously-increasing sequence of numbers" in {
isMonotonous( Seq( 1, 2, 3, 4, 5 ) ) should be( aSuccess )
}
"correctly render violations on a random sequence" in {
isMonotonous( Seq( 5, 4, 3, 2, 1 ) ) should failWith( "is not monotonously-increasing" )
}
}
}
An opinionated helper trait for combinator specifications. The recommended practice for defining new combinators is test-first via this specification: