File tree 1 file changed +3
-10
lines changed
scala/scala-impl/test/org/jetbrains/plugins/scala/lang/parser 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -21,19 +21,12 @@ trait ScalaParserTestOps {
21
21
s " [[Err( $err)]] "
22
22
23
23
def checkParseErrors (text : String ): ScalaFile = {
24
- val (code, expectedErrors) = extractExpectedErrors(text)
24
+ val (code, expectedErrors) = extractExpectedErrors(text.withNormalizedSeparator )
25
25
26
26
val file = parseText(code)
27
27
val errors = file.depthFirst().toSeq.filterByType[PsiErrorElement ]
28
- if (expectedErrors.isEmpty) {
29
- assert(errors.isEmpty, " Expected no errors but found: " + errors.map(_.getErrorDescription).mkString(" , " ))
30
- } else {
31
- val errorsWithPos = errors.map(psi => psi.getTextOffset -> psi.getErrorDescription).toSet
32
- val notFoundErrors = (expectedErrors -- errorsWithPos).toSeq.sortBy(_._1).map(_._2)
33
- val unexpectedErrors = (errorsWithPos -- expectedErrors).toSeq.sortBy(_._1).map(_._2)
34
- assert(unexpectedErrors.isEmpty, " Found unexpected errors: " + unexpectedErrors.mkString(" , " ))
35
- assert(notFoundErrors.isEmpty, " Expected errors but didn't find: " + notFoundErrors.mkString(" , " ))
36
- }
28
+ val errorsWithPos = errors.map(psi => psi.getTextOffset -> psi.getErrorDescription).toSet
29
+ assertEquals(" parse errors do not match" , expectedErrors.toSeq.sorted, errorsWithPos.toSeq.sorted)
37
30
file
38
31
}
39
32
}
You can’t perform that action at this time.
0 commit comments