Created
February 2, 2012 21:59
-
-
Save dhinojosa/1726050 to your computer and use it in GitHub Desktop.
Compounded Messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.oreilly.testingscala | |
import org.specs2.Specification | |
import org.specs2.execute.{NoDetails, Failure, Result, Details} | |
class RunningAllTestsSpecification extends Specification { | |
def is = | |
"Using the same shared instance of Barry White add some albums" ^ runItems | |
def runItems = { | |
var i = 0 | |
val list = List[Result]( | |
{(i = i+1); i must be_== (1)}, | |
{(i = i+1); i must be_== (10)}, | |
{(i = i+1); i must be_== (3)}, | |
{(i = i+1); i must be_== (7)}) | |
val failures = list.view.filter(_.isInstanceOf[Failure]).force | |
new Failure(failures.foldLeft("")(_ + _.message +"\n"), failures.foldLeft("")(_ + _.expected + "\n"), Nil, NoDetails()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment