Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Feature request: format specs2 "acceptance" specifications #45

etorreborre opened this Issue · 1 comment

2 participants


This feature would share some commonalities with issue #43 I think.

The idea is to align on the right a few symbols, like "^", separating "specification fragments":

  class ParserSpec extends Specification with matcher.ParserMatchers {  def is =
      "Parsers for numbers"                                                                   ^
      "beASuccess and succeedOn check if the parse succeeds"                                  ^
      { number("1") must beASuccess }                                                         ^
      { number("1i") must beAPartialSuccess }                                                 ^
      { number must succeedOn("12") }                                                         ^
      { number must succeedOn("12ab").partially }                                             ^
      { number must succeedOn("12").withResult(12) }                                          ^
      { number must succeedOn("12").withResult(equalTo(12)) }                                 ^
      { number("1") must haveSuccessResult("1") }                                             ^
      "beAFailure and failOn check if the parse fails"                                        ^
      { number must failOn("abc") }                                                           ^
      { number must failOn("abc").withMsg("string matching regex.*expected") }                ^
      { number must failOn("abc").withMsg(matching(".*string matching regex.*expected.*")) }  ^
      { number("i") must beAFailure }                                                         ^
      { number("i") must haveFailureMsg("i' found") }                                         ^
      "beAnError and errorOn check if the parser errors out completely"                       ^
      { error must errorOn("") }                                                              ^
      { error("") must beAnError }                                                            ^

      val parsers = NumberParsers

Maybe this is something I could do as a patch if you can give me some guidance on where to start.



Dear Matt,

I'm Richard O. Legendi, and at the moment I'm working on the Specs2 integration into the ScalaTest plugin for the ScalaIDE during the Google Summer of Code 2012 program.

The project is progressing nicely (you can find a few screenshots on the site mentioned above), and I would like to make a few additional features like auto-formatting Specs2 specifications to improve user experience.

I found that the ScalaIDE is using your scalariform library to do auto-formatting, and I would like to extend it to keep the original structure of the specifications. This way not only the ScalaIDE would benefit from the formatter but it would be usable from the command line, Sbt, Maven, etc.

Could you please give me some guidance on where to start? I think it would be required to create a new Formatter. Or do you have any other suggestions how should it be implemented? I haven't found any extension points or plugin structure in the code on the first search.

Thank you in advance!

@bambuchaAdm bambuchaAdm referenced this issue from a commit in bambuchaAdm/scalariform
@ktoso ktoso do not add newline for each function in `=> => =>` scenarios
resolves #45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.