-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcexp:novicehelp wanteditype:enhancement
Description
Currently, testing error messages is done by using check files in the ./tests/repl/ dir. This has several drawbacks, one of the largest being that these are hard to keep in sync since they are only tested by diffing.
It would be great to have a unit test that would work along the lines of:
@Test def typeMismatch =
checkErrors (
"""|class Foo {
| def bar: Int = "IIEK"
|}""".stripMargin,
)
.expect { implicit ctx =>
val defn = ctx.definitions
TypeMismatch(defn.StringType, defn.IntType) :: Nil
}To do this, we need to extend DottyTest and provide the context with a custom reporter that aggregates the errors instead of rendering them to stdout.
Metadata
Metadata
Assignees
Labels
area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcexp:novicehelp wanteditype:enhancement