Created
March 26, 2010 00:14
-
-
Save etorreborre/344299 to your computer and use it in GitHub Desktop.
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
class Example(description: String) { | |
def in[T](expectations: =>T)(implicit def m: scala.reflect.Manifest[T]): Example = { | |
if (m.erasure == this.getClass) | |
hasSubExamples = true | |
// store expectations for later evaluation | |
} | |
} | |
/** | |
* This allow me to define in specs examples which know if they have nested examples | |
* without having to be evaluated | |
*/ | |
"this example is simple" in { 1 must_== 1 } | |
"this example has a nested example but it doesn't have to be evaluated to know it!" in { | |
"I am nested" in { 1 must_== 1 } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment