diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/parserNoSuccessMessage.check | 20 | ||||
-rw-r--r-- | test/files/run/parserNoSuccessMessage.scala | 19 |
2 files changed, 39 insertions, 0 deletions
diff --git a/test/files/run/parserNoSuccessMessage.check b/test/files/run/parserNoSuccessMessage.check new file mode 100644 index 0000000000..fe00d2fd3a --- /dev/null +++ b/test/files/run/parserNoSuccessMessage.check @@ -0,0 +1,20 @@ +[1.2] failure: string matching regex `\d+' expected but `x' found + +-x + ^ +[1.1] failure: string matching regex `\d+' expected but `x' found + +x +^ +[1.3] parsed: (Some(-)~5) +[1.2] parsed: (None~5) +[1.2] error: Number expected! + +-x + ^ +[1.1] error: Number expected! + +x +^ +[1.3] parsed: (Some(-)~5) +[1.2] parsed: (None~5) diff --git a/test/files/run/parserNoSuccessMessage.scala b/test/files/run/parserNoSuccessMessage.scala new file mode 100644 index 0000000000..93aa252db0 --- /dev/null +++ b/test/files/run/parserNoSuccessMessage.scala @@ -0,0 +1,19 @@ +object Test extends scala.util.parsing.combinator.RegexParsers { + def sign = "-" + def number = "\\d+".r + def p = sign.? ~ number withErrorMessage "Number expected!" + def q = sign.? ~! number withErrorMessage "Number expected!" + + def main(args: Array[String]) { + println(parseAll(p, "-x")) + println(parseAll(p, "x")) + println(parseAll(p, "-5")) + println(parseAll(p, "5")) + println(parseAll(q, "-x")) + println(parseAll(q, "x")) + println(parseAll(q, "-5")) + println(parseAll(q, "5")) + } +} + + |