Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created March 26, 2010 00:14
Show Gist options
  • Save etorreborre/344299 to your computer and use it in GitHub Desktop.
Save etorreborre/344299 to your computer and use it in GitHub Desktop.
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