mirror of https://github.com/sbt/sbt.git
Re-add scripted test
This commit is contained in:
parent
87e9250cb2
commit
d970ab3af3
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
// the version should override the one from the global plugin
|
||||
libraryDependencies += "junit" % "junit" % "4.8"
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue