mirror of
https://github.com/KarolS/millfork.git
synced 2024-12-23 23:30:22 +00:00
Improve syntax error reporting in tests
This commit is contained in:
parent
5380eb39c7
commit
259d871786
@ -117,7 +117,11 @@ object ShouldNotCompile extends Matchers {
|
|||||||
case f: Failure[_, _] =>
|
case f: Failure[_, _] =>
|
||||||
println(f.extra.toString)
|
println(f.extra.toString)
|
||||||
println(f.lastParser.toString)
|
println(f.lastParser.toString)
|
||||||
log.error("Syntax error: " + parserF.lastLabel, Some(parserF.lastPosition))
|
if (parserF.lastLabel != "") {
|
||||||
|
options.log.error(s"Syntax error: ${parserF.lastLabel} expected", Some(parserF.lastPosition))
|
||||||
|
} else {
|
||||||
|
options.log.error("Syntax error", Some(parserF.lastPosition))
|
||||||
|
}
|
||||||
fail("syntax error")
|
fail("syntax error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,11 @@ object ShouldNotParse extends Matchers {
|
|||||||
case f: Failure[_, _] =>
|
case f: Failure[_, _] =>
|
||||||
println(f.extra.toString)
|
println(f.extra.toString)
|
||||||
log.warn("Last parser: " + f.lastParser, Some(parserF.indexToPosition(f.index, f.lastParser.toString)))
|
log.warn("Last parser: " + f.lastParser, Some(parserF.indexToPosition(f.index, f.lastParser.toString)))
|
||||||
log.warn("Expected syntax error: " + parserF.lastLabel, Some(parserF.lastPosition))
|
if (parserF.lastLabel != "") {
|
||||||
|
log.warn(s"Expected syntax error: ${parserF.lastLabel} expected", Some(parserF.lastPosition))
|
||||||
|
} else {
|
||||||
|
log.warn("Expected syntax error", Some(parserF.lastPosition))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user