Skip to content

Instantly share code, notes, and snippets.

@bvenners
Last active August 29, 2015 14:05
Show Gist options
  • Save bvenners/05fe6323a132b1c7d9eb to your computer and use it in GitHub Desktop.
Save bvenners/05fe6323a132b1c7d9eb to your computer and use it in GitHub Desktop.
ScalaTest brings 1/100th the number of implicits into scope compared to specs2
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
scala> def countImplicits(tp: Type): Int = tp.members.count(_.isImplicit)
countImplicits: (tp: reflect.runtime.universe.Type)Int
scala> countImplicits(typeOf[org.specs2.mutable.Specification])
res0: Int = 205
scala> countImplicits(typeOf[org.scalatest.Spec])
res1: Int = 2
scala> countImplicits(typeOf[org.scalatest.Spec with org.scalatest.Matchers])
res2: Int = 7
// Try it and see for yourself. Run test:console using this sbt file:
scalaVersion := "2.11.2"
libraryDependencies += "org.specs2" %% "specs2" % "2.4.1" % "test"
libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.2" % "test"
// Note this is one reason why ScalaTest in general compiles faster than specs2,
// as described in this article:
//
// http://www.artima.com/articles/compile_time.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment