Skip to content
Browse files

Bumped the Scalatest/Specs versions for 2.10.0-RC3

* Modified tests to use mutable Specs API
* Fixed a few minor specs issues.
  • Loading branch information...
1 parent cdd2e72 commit 0c08c1169e478d9e46323f6e074c5dedbca4ffe3 @jsuereth jsuereth committed with Dec 4, 2012
View
5 ivy/src/test/scala/ComponentManagerTest.scala
@@ -1,7 +1,8 @@
package sbt
import java.io.File
-import org.specs._
+import org.specs2._
+import mutable.Specification
import IO.{createDirectory, delete, touch, withTemporaryDirectory}
import org.apache.ivy.util.ChecksumHelper
import IfMissing.Fail
@@ -78,4 +79,4 @@ object ComponentManagerTest extends Specification
private def randomString = "asdf"
private def withManager[T](f: ComponentManager => T): T =
TestLogger( logger => withTemporaryDirectory { temp => f(new ComponentManager(xsbt.boot.Locks, new xsbt.boot.ComponentProvider(temp, true), None, logger)) } )
-}
+}
View
24 launch/src/test/scala/ScalaProviderTest.scala
@@ -4,30 +4,30 @@ import java.io.{File,InputStream}
import java.net.URL
import java.util.Properties
import xsbti._
-import org.specs._
+import org.specs2._
+import mutable.Specification
import LaunchTest._
import sbt.IO.{createDirectory, touch,withTemporaryDirectory}
object ScalaProviderTest extends Specification
{
- def provide = addToSusVerb("provide")
- "Launch" should provide {
- "ClassLoader for Scala 2.8.0" in { checkScalaLoader("2.8.0") }
- "ClassLoader for Scala 2.8.2" in { checkScalaLoader("2.8.2") }
- "ClassLoader for Scala 2.9.0" in { checkScalaLoader("2.9.0") }
- "ClassLoader for Scala 2.9.2" in { checkScalaLoader("2.9.2") }
+ "Launch" should {
+ "provide ClassLoader for Scala 2.8.0" in { checkScalaLoader("2.8.0") }
+ "provide ClassLoader for Scala 2.8.2" in { checkScalaLoader("2.8.2") }
+ "provide ClassLoader for Scala 2.9.0" in { checkScalaLoader("2.9.0") }
+ "provide ClassLoader for Scala 2.9.2" in { checkScalaLoader("2.9.2") }
}
"Launch" should {
"Successfully load an application from local repository and run it with correct arguments" in {
- checkLoad(List("test"), "xsbt.boot.test.ArgumentTest").asInstanceOf[Exit].code must be(0)
+ checkLoad(List("test"), "xsbt.boot.test.ArgumentTest").asInstanceOf[Exit].code must equalTo(0)
checkLoad(List(), "xsbt.boot.test.ArgumentTest") must throwA[RuntimeException]
}
"Successfully load an application from local repository and run it with correct sbt version" in {
- checkLoad(List(AppVersion), "xsbt.boot.test.AppVersionTest").asInstanceOf[Exit].code must be(0)
+ checkLoad(List(AppVersion), "xsbt.boot.test.AppVersionTest").asInstanceOf[Exit].code must equalTo(0)
}
"Add extra resources to the classpath" in {
- checkLoad(testResources, "xsbt.boot.test.ExtraTest", createExtra).asInstanceOf[Exit].code must be(0)
+ checkLoad(testResources, "xsbt.boot.test.ExtraTest", createExtra).asInstanceOf[Exit].code must equalTo(0)
}
}
@@ -65,7 +65,7 @@ object LaunchTest
def testApp(main: String): Application = testApp(main, Array[File]())
def testApp(main: String, extra: Array[File]): Application = Application("org.scala-sbt", "launch-test", new Explicit(AppVersion), main, Nil, false, extra)
import Predefined._
- def testRepositories = List(Local, ScalaToolsReleases, ScalaToolsSnapshots).map(Repository.Predefined.apply)
+ def testRepositories = List(Local, ScalaToolsReleases, ScalaToolsSnapshots).map(Repository.Predefined(_))
def withLauncher[T](f: xsbti.Launcher => T): T =
withTemporaryDirectory { bootDirectory =>
f(Launcher(bootDirectory, testRepositories))
@@ -86,4 +86,4 @@ object LaunchTest
try { properties.load(propertiesStream) } finally { propertiesStream.close() }
properties
}
-}
+}
View
15 main/src/test/scala/TagsTest.scala
@@ -1,22 +1,25 @@
package sbt
import org.scalacheck._
-import Gen.{genInt,listOf,genString}
+import Gen.{listOf}
import Prop.forAll
import Tags._
object TagsTest extends Properties("Tags")
{
def tagMap: Gen[TagMap] = for(ts <- listOf(tagAndFrequency)) yield ts.toMap
- def tagAndFrequency: Gen[(Tag, Int)] = for(t <- tag; count <- genInt) yield (t, count)
- def tag: Gen[Tag] = for(s <- genString) yield Tag(s)
+ def tagAndFrequency: Gen[(Tag, Int)] = for(t <- tag; count <- Arbitrary.arbitrary[Int]) yield (t, count)
+ def tag: Gen[Tag] = for(s <- Arbitrary.arbitrary[String]) yield Tag(s)
+ implicit def aTagMap = Arbitrary(tagMap)
+ implicit def aTagAndFrequency = Arbitrary(tagAndFrequency)
+ implicit def aTag = Arbitrary(tag)
property("exclusive allows all groups without the exclusive tag") = forAll { (tm: TagMap, tag: Tag) =>
excl(tag)(tm - tag)
}
property("exclusive only allows a group with an excusive tag when the size is one") = forAll { (tm: TagMap, size: Int, etag: Tag) =>
- val tm: TagMap = tm.updated(etag, math.abs(size))
- excl(etag)(tm) == (size <= 1)
+ val tm2: TagMap = tm.updated(etag, math.abs(size))
+ excl(etag)(tm2) == (size <= 1)
}
property("exclusive always allows a group of size one") = forAll { (etag: Tag, mapTag: Tag) =>
val tm: TagMap = Map(mapTag -> 1)
@@ -25,4 +28,4 @@ object TagsTest extends Properties("Tags")
private[this] def excl(tag: Tag): TagMap => Boolean = predicate(exclusive(tag) :: Nil)
-}
+}
View
4 project/Util.scala
@@ -30,8 +30,8 @@ object Util
lazy val base: Seq[Setting[_]] = Seq(scalacOptions ++= Seq("-Xelide-below", "0"), projectComponent) ++ Licensed.settings
def testDependencies = libraryDependencies ++= Seq(
- "org.scalacheck" % "scalacheck_2.10.0-M5" % "1.10.0" % "test",
- "org.scala-tools.testing" % "specs_2.9.1" % "1.6.9" % "test"
+ "org.scalacheck" % "scalacheck_2.10.0-RC3" % "1.10.0" % "test",
+ "org.specs2" % "specs2_2.10.0-RC3" % "1.12.3" % "test"
)
lazy val minimalSettings: Seq[Setting[_]] = Defaults.paths ++ Seq[Setting[_]](crossTarget <<= target.identity, name <<= thisProject(_.id))
View
7 util/io/src/test/scala/StashSpec.scala
@@ -3,7 +3,8 @@
package sbt
-import org.specs._
+import org.specs2._
+import mutable.Specification
import IO._
import java.io.File
@@ -62,7 +63,7 @@ object CheckStash extends Specification
def correct(check: File, ref: (File, String)) =
{
check.exists must beTrue
- read(check) must beEqual(ref._2)
+ read(check) must equalTo(ref._2)
}
def noneExist(s: Seq[File]) = s.forall(!_.exists) must beTrue
@@ -79,4 +80,4 @@ object CheckStash extends Specification
}
class TestError extends Error
class TestRuntimeException extends RuntimeException
-class TestException extends Exception
+class TestException extends Exception

0 comments on commit 0c08c11

Please sign in to comment.
Something went wrong with that request. Please try again.