etorreborre/specs2 — Issue #63: Parser fails mysteriously
Author: dcsobral
Created: 2012-02-17 18:17:00+00:00
State: open

This parser:

class ExpressionParser extends scala.util.parsing.combinator.RegexParsers {
def number: Parser[Any] = "\\d+".r ^^ (_.toInt)
}

Fails this test:

import org.specs2._

class CalcTest extends Specification with matcher.ParserMatchers {
val calc = new Calculator
val parsers = new ExpressionParser
import parsers._

def is =
"Calculator Tests".title ^
p^
{ number must succeedOn("1").withResult(1) } ^
end
}

It works, however, if the parser result is changed to `Int`.