etorreborre/specs2 — Issue #50: Nicer message when doing ^^(... aka("..."))
Author: ziggystar
Created: 2011-12-20 10:32:21+00:00
State: open

Suppose the following spec:

``` scala
class DataPoints extends Specification {
val objectUnderTest: Int => Int = _ + 2

val testCases = 1 :: 2 :: 3 :: 4 :: Nil

def is: Fragments =
(objectUnderTest must multiplyByTwo((_: Int))).foreach(testCases)

def multiplyByTwo(i: Int): Matcher[(Int) => Int] =
(=== (i * 2)) ^^
((f: Int => Int) => f(i) aka "result of applying %s to %d".format(f, i))
}
```

This produces the following output:

result of applying to 1 '3' is not equal to '2'; ...

I find the `aka` string does not go well with the `'3'`. Maybe put the `'3'` in parenthesis; or write `'3' (aka result of applying ...)`; or write a `:` after the aka string.

But as it is now it's not nice to read.