diff options
author | Enno Runne <enno.runne@baymarkets.com> | 2017-02-14 21:16:47 +0100 |
---|---|---|
committer | Enno Runne <enno.runne@baymarkets.com> | 2017-02-14 21:16:47 +0100 |
commit | 81cda70db72046901e8ca5f8c958224cafdf1bf4 (patch) | |
tree | 71c00946da2050fdafa2349e6bc3891237b0b0de /compiler/test/dotty/tools/dotc/reporting | |
parent | 606e36be88c47cd3f2e8856d6bd6b95aed7aa191 (diff) | |
download | dotty-81cda70db72046901e8ca5f8c958224cafdf1bf4.tar.gz dotty-81cda70db72046901e8ca5f8c958224cafdf1bf4.tar.bz2 dotty-81cda70db72046901e8ca5f8c958224cafdf1bf4.zip |
Change '... expected but found ...' to Message
Diffstat (limited to 'compiler/test/dotty/tools/dotc/reporting')
-rw-r--r-- | compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTest.scala | 2 | ||||
-rw-r--r-- | compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTest.scala b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTest.scala index 57d66c60b..9be98ee65 100644 --- a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTest.scala +++ b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTest.scala @@ -65,7 +65,7 @@ trait ErrorMessagesTest extends DottyTest { } def assertMessageCount(expected: Int, messages: List[Message]): Unit = - assertEquals( + assertEquals(messages.mkString, expected, messages.length ) diff --git a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala index d9b7f7f67..697a00510 100644 --- a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala +++ b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala @@ -4,6 +4,7 @@ package reporting import core.Contexts.Context import diagnostic.messages._ +import dotty.tools.dotc.parsing.Tokens import org.junit.Assert._ import org.junit.Test @@ -107,4 +108,32 @@ class ErrorMessagesTests extends ErrorMessagesTest { assertEquals("value a", definition.show) } + @Test def unexpectedToken = + checkMessagesAfter("frontend") { + """ + |object Forward { + | def val = "ds" + |} + """.stripMargin + } + .expect { (ictx, messages) => + implicit val ctx: Context = ictx + val defn = ictx.definitions + + assertMessageCount(1, messages) + val ExpectedTokenButFound(expected, found, foundName) :: Nil = messages + assertEquals(Tokens.IDENTIFIER, expected) + assertEquals(Tokens.VAL, found) + assertEquals("val", foundName.show) + } + + @Test def expectedToken = + checkMessagesAfter("frontend") { + """ + |object Forward { + | def `val` = "ds" + |} + """.stripMargin + } + .expectNoErrors } |