-
-
Save etorreborre/aabb6874d20a0ee1b16e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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