Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harrah committed May 28, 2011
1 parent d81273a commit 14e91b1
Show file tree
Hide file tree
Showing 42 changed files with 61 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sbt._

object SingleBuild extends Build with Marker
{
lazy val projects = if(file("multi").exists) Seq(root, sub, sub2) else Seq(root)
override def projects = if(file("multi").exists) Seq(root, sub, sub2) else Seq(root)
lazy val root = Project("root", file("."), aggregate = if(file("aggregate").exists) Seq(sub) else Nil )
lazy val sub = Project("sub", file("sub"), aggregate = Seq(sub2))
lazy val sub2 = Project("sub2", file("sub") / "sub")
Expand Down
1 change: 0 additions & 1 deletion sbt/src/sbt-test/actions/run-task/project/B.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Keys._

object B extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
myRun,
fork in demo := true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

object ArtifactTest extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
publishTo := Some(Resolver.file("Test Publish Repo", file("test-repo"))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

object ExcludeScala extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
libraryDependencies <++= baseDirectory(dependencies),
scalaVersion := "2.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@

object TestProject extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
libraryDependencies <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")),
TaskKey("check-transitive") <<= check(true),
TaskKey("check-intransitive") <<= check(false)
TaskKey[Unit]("check-transitive") <<= check(true),
TaskKey[Unit]("check-intransitive") <<= check(false)
)

def transitive(dep: ModuleID)(base: File) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

object InfoTest extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
ivyXML <<= (customInfo, organization, moduleID, version) apply inlineXML,
projectID ~= (_ cross false),
customInfo <<= baseDirectory{_ / "info" exists },
TaskKey("check-download") <<= checkDownload,
TaskKey[Unit]("check-download") <<= checkDownload,
delivered <<= deliverLocal map XML.loadFile,
TaskKey("check-info") <<= checkInfo
TaskKey[Unit]("check-info") <<= checkInfo
)
lazy val delivered = TaskKey[NodeSeq]("delivered")
lazy val customInfo = SettingKey[Boolean]("custom-info")
Expand All @@ -29,14 +28,14 @@ object InfoTest extends Build
else
<dependency org="org.scalacheck" name="scalacheck" rev="1.5"/>

def checkDownload = (dependencyClasspath in Compile) map { cp => if(cp.isEmpty) error("Dependency not downloaded") }
def checkDownload = (dependencyClasspath in Compile) map { cp => if(cp.isEmpty) error("Dependency not downloaded"); () }
def checkInfo = (customInfo, delivered) map { (addInfo, d) =>
if((d \ "info").isEmpty)
error("No info tag generated")
else if(addInfo) {
if( !deliveredWithCustom(d) ) error("Expected 'license' and 'description' tags in info tag, got: \n" + (d \ "info"))
if( !deliveredWithCustom(d) ) error("Expected 'license' and 'description' tags in info tag, got: \n" + (d \ "info")) else ()
} else
if( deliveredWithCustom(d) ) error("Expected empty 'info' tag, got: \n" + (d \ "info"))
if( deliveredWithCustom(d) ) error("Expected empty 'info' tag, got: \n" + (d \ "info")) else ()
}
def deliveredWithCustom(d: NodeSeq) = !(d \ "info" \ "license").isEmpty && !(d \ "info" \ "description").isEmpty
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ object TestProject extends Build
override lazy val settings = super.settings :+
( ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) )

lazy val projects = Seq(a, b)
lazy val a = Project("a", file("a")) delegateTo(b) settings(
libraryDependencies += "com.camptocamp.tl.caltar" % "core" % "0.5" intransitive()
)
Expand Down

This file was deleted.

This file was deleted.

41 changes: 0 additions & 41 deletions sbt/src/sbt-test/dependency-management/inline-default/test

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"

ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))

TaskKey("check") <<= update map { report =>
TaskKey[Unit]("check") <<= update map { report =>
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(!files.isEmpty, "ScalaCheck module not found in update report")
val missing = files.filter(! _.exists)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
seq(externalIvySettings(), externalIvyFile())

TaskKey("check") <<= (baseDirectory, update) map { (base, report) =>
TaskKey[Unit]("check") <<= (baseDirectory, update) map { (base, report) =>
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(!files.isEmpty, "ScalaCheck module not found in update report")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ externalIvySettings()

libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"

TaskKey("check") <<= (baseDirectory, update) map { (base, report) =>
TaskKey[Unit]("check") <<= (baseDirectory, update) map { (base, report) =>
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(!files.isEmpty, "ScalaCheck module not found in update report")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

object MakePomTest extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
readPom <<= makePom map XML.loadFile,
TaskKey("check-pom") <<= checkPom,
TaskKey("check-extra") <<= checkExtra,
TaskKey[Unit]("check-pom") <<= checkPom,
TaskKey[Unit]("check-extra") <<= checkExtra,
makePomConfiguration ~= { _.copy(extra = <extra-tag/>) }
)

Expand All @@ -30,7 +29,7 @@ object MakePomTest extends Build
lazy val checkExtra = readPom map { pomXML =>
checkProject(pomXML)
val extra = pomXML \ extraTagName
if(extra.isEmpty) error("'" + extraTagName + "' not found in generated pom.xml.")
if(extra.isEmpty) error("'" + extraTagName + "' not found in generated pom.xml.") else ()
}

lazy val checkPom = (readPom, fullResolvers) map { (pomXML, ivyRepositories) =>
Expand All @@ -44,6 +43,8 @@ object MakePomTest extends Build

if( writtenRepositories != mavenStyleRepositories )
error("Written repositories did not match declared repositories.\n\t" + explain)
else
()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<ivysettings>
<settings defaultResolver="lag"/>
<settings defaultResolver="chain"/>
<caches defaultCacheDir="${ivy.settings.dir}/target/cache"/>
<resolvers>
<ibiblio name="lag" m2compatible="true" root="http://www.lag.net/repo/"/>
<chain name="chain" returnFirst="true">
<ibiblio name="scala-tools-releases" m2compatible="true" root="http://scala-tools.org/repo-releases/"/>
</chain>
</resolvers>
</ivysettings>
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

object SettingsTest extends Build
{
lazy val projects = Seq(parent, sub, configgy)
lazy val parent: Project = Project("Parent", file(".")) aggregate(sub) settings(
externalIvySettings(),
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
)
lazy val sub: Project = Project("Sub", file("sub"), delegates = parent :: Nil) dependsOn(configgy) aggregate(configgy) settings(
lazy val sub: Project = Project("Sub", file("sub"), delegates = parent :: Nil) dependsOn(compiler) aggregate(compiler) settings(
externalIvySettings()
)
lazy val configgy = Project("Configgy", file("configgy"), delegates = sub :: Nil) settings(
libraryDependencies += "net.lag" % "configgy" % "1.1"
lazy val compiler = Project("Compiler", file("compiler"), delegates = sub :: Nil) settings(
libraryDependencies <+= scalaVersion( "org.scala-lang" % "scala-compiler" % _ )
)
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

object ParentTest extends Build
{
lazy val projects = Seq(parent, core, reporters, jfreechart)
lazy val parent: Project = Project("Flowmodel", file(".")) aggregate(core, reporters)
lazy val core: Project = Project("Flowmodel core", file("core"), delegates = parent :: Nil)
lazy val reporters: Project = Project("Extra reporters", file("reporters"), delegates = parent :: Nil) aggregate(jfreechart) dependsOn(jfreechart)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

object PomRepoTest extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
resolvers ++= Seq(local, ScalaToolsSnapshots),
InputKey("check-pom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories },
InputKey[Unit]("check-pom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories },
makePomConfiguration <<= (makePomConfiguration, baseDirectory) { (conf, base) =>
conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) )
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ object MultiPublishTest extends Build
externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
}

lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
name := "Retrieve Test",
libraryDependencies := if("mavenStyle".asFile.exists) mavenStyleDependencies else ivyStyleDependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ object MultiPublishTest extends Build
externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
)

lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( mavenStyle, name = "Publish Test" )

lazy val sub = Project("sub", file("sub")) settings( mavenStyle, name = "Sub Project" )
Expand Down
18 changes: 11 additions & 7 deletions sbt/src/sbt-test/dependency-management/sources/project/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@ import Keys._

object Test extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
libraryDependencies += "net.liftweb" % "lift-webkit" % "1.0" intransitive(),
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" intransitive(),
transitiveClassifiers := Seq("sources"),
TaskKey("check-sources") <<= updateClassifiers map checkSources,
TaskKey("check-binaries") <<= update map checkBinaries
TaskKey[Unit]("check-sources") <<= updateClassifiers map checkSources,
TaskKey[Unit]("check-binaries") <<= update map checkBinaries
)
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )
def checkSources(report: UpdateReport) =
def checkSources(report: UpdateReport): Unit =
{
val srcs = getSources(report)
if(srcs.isEmpty) error("No sources retrieved") else if(srcs.size != 2) error("Incorrect sources retrieved:\n\t" + srcs.mkString("\n\t"))
if(srcs.isEmpty)
error("No sources retrieved")
else if(srcs.size != 2)
error("Incorrect sources retrieved:\n\t" + srcs.mkString("\n\t"))
else
()
}
def checkBinaries(report: UpdateReport) =
def checkBinaries(report: UpdateReport): Unit =
{
val srcs = getSources(report)
if(!srcs.isEmpty) error("Sources retrieved:\n\t" + srcs.mkString("\n\t"))
if(!srcs.isEmpty) error("Sources retrieved:\n\t" + srcs.mkString("\n\t")) else ()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

object TestProject extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings(
libraryDependencies += "slinky" % "slinky" % "2.1" % "test" from "http://slinky2.googlecode.com/svn/artifacts/2.1/slinky.jar",
TaskKey("check-in-test") <<= checkClasspath(Test),
TaskKey("check-in-compile") <<= checkClasspath(Compile)
TaskKey[Unit]("check-in-test") <<= checkClasspath(Test),
TaskKey[Unit]("check-in-compile") <<= checkClasspath(Compile)
)

lazy val checkInTest = checkClasspath(testClasspath)
Expand All @@ -18,6 +17,7 @@ object TestProject extends Build
{
val loader = ClasspathUtilities.toLoader(cp)
Class.forName("slinky.http.Application", false, loader)
()
}
catch
{
Expand Down
2 changes: 1 addition & 1 deletion sbt/src/sbt-test/java/argfile/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ scalaSource in Configurations.Compile <<= sourceDirectory( _ / " scala test " )

javaSource in Configurations.Compile <<= sourceDirectory( _ / " java test " )

TaskKey("init") <<= (scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) =>
TaskKey[Unit]("init") <<= (scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) =>
import IO._
createDirectories(ss :: js :: Nil)
copyFile(file("changes") / "Test.scala", ss / " Test s.scala")
Expand Down
10 changes: 7 additions & 3 deletions sbt/src/sbt-test/java/track-anonymous/build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import sbt.complete.DefaultParsers._

InputKey("check-output") <<= {
InputKey[Unit]("check-output") <<= {
val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) )
def action(result: TaskKey[Boolean]) =
(classDirectory in Configurations.Compile, result) map { (dir, shouldExist) =>
if((dir / "Anon.class").exists != shouldExist) error("Top level class incorrect" )
else if( (dir / "Anon$1.class").exists != shouldExist) error("Inner class incorrect" )
if((dir / "Anon.class").exists != shouldExist)
error("Top level class incorrect" )
else if( (dir / "Anon$1.class").exists != shouldExist)
error("Inner class incorrect" )
else
()
}
InputTask(s => parser)(action)
}
2 changes: 1 addition & 1 deletion sbt/src/sbt-test/project/Class.forName/changes/build2.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
crossPaths :== false

TaskKey("use-jar") := { injar.Test.other; () }
TaskKey[Unit]("use-jar") := { injar.Test.other; () }
Loading

0 comments on commit 14e91b1

Please sign in to comment.