Re-add scripted test

This commit is contained in:
Dan Sanduleac 2014-05-19 18:29:23 +01:00
parent 87e9250cb2
commit d970ab3af3
4 changed files with 43 additions and 3 deletions

View File

@ -0,0 +1,21 @@
import sbt._
import sbt.Keys._
object MyBuild extends Build {
lazy val mySettings = Defaults.defaultSettings ++ Seq(
name := "my-test-proj",
organization := "com.example",
check <<= update map checkVersion,
version := "0.1.0-SNAPSHOT")
lazy val proj = Project("my-test-proj", file("."), settings = mySettings)
lazy val check = taskKey[Unit]("Verifies that the junit dependency has the newer version (4.8)")
def checkVersion(report: UpdateReport) {
for(mod <- report.allModules) {
if(mod.name == "junit") assert(mod.revision == "4.8", s"JUnit version (${mod.revision}) does not have the correct version")
}
}
}

View File

@ -0,0 +1,3 @@
// use a small java library instead of a plugin to avoid incompatibilities when upgrading
// This version should be overridden by the one in the project.
libraryDependencies += "junit" % "junit" % "4.5"

View File

@ -0,0 +1,2 @@
// the version should override the one from the global plugin
libraryDependencies += "junit" % "junit" % "4.8"

View File

@ -1,4 +1,18 @@
# tests that a source file in $sbt.global.base/plugins/ is available to the build definition in project/
$ copy-file changes/Build.scala project/Build.scala
> reload
# dummy to ensure project gets loaded
> name
# ensure that a new global dependency gets picked up
$ copy-file changes/global-plugins.sbt global/plugins/plugins.sbt
> reload
# check that the class can be loaded
> eval Class.forName("org.junit.Test")
# check that it is on the classpath
> eval (x => ()) : (org.junit.Test => Unit)
# ensure that the global plugin version is overridden by the local version
# (because it's older)
$ copy-file changes/plugins.sbt project/plugins.sbt
> reload
> check