sbt-doctest
sbt-doctest copied to clipboard
Check compile errors
In refined are examples that show compile errors in certain situations:
/**
* Creates a `scala.util.matching.Regex` from a validated string.
*
* Example: {{{
* scala> import eu.timepit.refined.implicits._
* | import eu.timepit.refined.util.string.regex
*
* scala> regex(".*")
* res1: scala.util.matching.Regex = .*
*
* scala> regex("{")
* <console>:41: error: Predicate isValidRegex("{") failed: Illegal repetition
* {
* regex("{")
* ^
* }}}
*/
def ...
The first example is verified by sbt-doctest but the second is not. It would be awesome if sbt-doctest could also verify non-compiling examples.
shapeless has something like this called illTyped which also can check the error message.