fix some tests

This commit is contained in:
Mark Harrah 2011-06-10 07:48:53 -04:00
parent 1f6f1ea0da
commit 13adcfb28c
14 changed files with 44 additions and 42 deletions

View File

@ -58,7 +58,7 @@ object CompileTest extends Specification
private def testClasspath(scalaVersion: String) =
WithCompiler.launcher { (launch, log) =>
def compiler(bootLibrary: Boolean, compilerOnClasspath: Boolean): RawCompiler =
new RawCompiler(ScalaInstance(scalaVersion, launch), new ClasspathOptions(bootLibrary, compilerOnClasspath, true, true, true), log)
new RawCompiler(ScalaInstance(scalaVersion, launch), new ClasspathOptions(bootLibrary, compilerOnClasspath, true, true, bootLibrary), log)
val callback = new xsbti.TestCallback
@ -75,17 +75,17 @@ object CompileTest extends Specification
val plainSrcs = Seq[File](plain)
val compSrcs = Seq[File](useCompiler)
withTemporaryDirectory { out =>
shouldSucceed( standard(plainSrcs, Nil, out, Nil) )//success
shouldSucceed( standard(compSrcs, Nil, out, Nil) )//success
shouldSucceed( standard(plainSrcs, Nil, out, Nil) )
shouldSucceed( standard(compSrcs, Nil, out, Nil) )
shouldSucceed( noCompiler(plainSrcs, Nil, out, Nil) )//success
shouldSucceed( noCompiler(plainSrcs, Nil, out, Nil) )
shouldFail( noCompiler(compSrcs, Nil, out, Nil) )
shouldSucceed( noCompiler(compSrcs, withCompiler, out, Nil) )//success
shouldSucceed( noCompiler(compSrcs, withCompiler, out, Nil) )
shouldFail( fullExplicit(plainSrcs, Nil, out, Nil) )// failure
shouldFail( fullExplicit(compSrcs, Nil, out, Nil) )// failure
shouldSucceed( fullExplicit(plainSrcs, withLibrary, out, fullBoot) )// success
shouldSucceed( fullExplicit(compSrcs, withLibraryCompiler, out, fullBoot) )// success
shouldFail( fullExplicit(plainSrcs, Nil, out, Nil) )
shouldFail( fullExplicit(compSrcs, Nil, out, Nil) )
shouldSucceed( fullExplicit(plainSrcs, withLibrary, out, fullBoot) )
shouldSucceed( fullExplicit(compSrcs, withLibraryCompiler, out, fullBoot) )
true must beTrue
}
}

View File

@ -8,7 +8,7 @@ package compiler
object TestCompile
{
def allVersions = List("2.7.4", "2.8.1", "2.9.0.RC1")//List("2.7.4", "2.7.7", "2.8.0", "2.8.1", "2.9.0.RC1")
def allVersions = List("2.8.1", "2.9.0-1")
/** Tests running the compiler interface with the analyzer plugin with a test callback. The test callback saves all information
* that the plugin sends it for post-compile analysis by the provided function.*/
def apply[T](scalaVersion: String, sources: Seq[File], outputDirectory: File, options: Seq[String])

View File

@ -13,10 +13,10 @@ object ScalaProviderTest extends Specification
"Launch" should provide {
"ClassLoader for Scala 2.7.4" in { checkScalaLoader("2.7.4") }
"ClassLoader for Scala 2.7.5" in { checkScalaLoader("2.7.5") }
"ClassLoader for Scala 2.7.6" in { checkScalaLoader("2.7.6") }
"ClassLoader for Scala 2.7.7" in { checkScalaLoader("2.7.7") }
"ClassLoader for Scala 2.8.0" in { checkScalaLoader("2.8.0") }
"ClassLoader for Scala 2.8.1" in { checkScalaLoader("2.8.1") }
"ClassLoader for Scala 2.9.0-1" in { checkScalaLoader("2.9.0-1") }
}
"Launch" should {
@ -74,7 +74,7 @@ object LaunchTest
def mapScalaVersion(versionNumber: String) = scalaVersionMap.find(_._2 == versionNumber).getOrElse {
error("Scala version number " + versionNumber + " from library.properties has no mapping")}._1
val scalaVersionMap = List("2.8.0", "2.8.1", "2.9.0.RC1").map(x => (x,x)).toMap ++ List("2.7.4", "2.7.5", "2.7.6", "2.7.7").map(v => (v, v + ".final"))
val scalaVersionMap = Map("2.9.0-1" -> "2.9.0.1") ++ List("2.7.4", "2.7.5", "2.7.6", "2.7.7", "2.8.0", "2.8.1").map(v => (v, v + ".final"))
def getScalaVersion: String = getScalaVersion(getClass.getClassLoader)
def getScalaVersion(loader: ClassLoader): String = loadProperties(loader, "library.properties").getProperty("version.number")
lazy val AppVersion = loadProperties(getClass.getClassLoader, "xsbt.version.properties").getProperty("version")

View File

@ -6,7 +6,7 @@ object InfoTest extends Build
{
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,
ivyXML <<= (customInfo, organization, moduleName, version) apply inlineXML,
projectID ~= (_ cross false),
customInfo <<= baseDirectory{_ / "info" exists },
TaskKey[Unit]("check-download") <<= checkDownload,

View File

@ -1,7 +1,7 @@
{
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.10.0-SNAPSHOT/[artifact]-[revision].[ext]"
def snapshotPattern = "http://repo.typesafe.com/typesafe/scala-tools-snapshots/[organization]/[module]/2.10.0-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
moduleConfigurations += ModuleConfiguration("org.scala-lang", "*", "2.10.0-.*", scalaSnapshots)
}
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110412.015459-16"
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110531.020043-60"

View File

@ -1,7 +1,7 @@
{
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.10.0-SNAPSHOT/[artifact]-[revision].[ext]"
def snapshotPattern = "http://repo.typesafe.com/typesafe/scala-tools-snapshots/[organization]/[module]/2.10.0-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
moduleConfigurations += ModuleConfiguration("org.not-scala-lang", "*", "2.10.0-.*", scalaSnapshots)
}
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110412.015459-16"
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110531.020043-60"

View File

@ -1,7 +1,7 @@
{
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.10.a-SNAPSHOT/[artifact]-[revision].[ext]"
def snapshotPattern = "http://repo.typesafe.com/typesafe/scala-tools-snapshots/[organization]/[module]/2.10.a-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
moduleConfigurations += ModuleConfiguration("org.scala-lang", "*", "2.10.0-.*", scalaSnapshots)
}
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110412.015459-16"
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110531.020043-60"

View File

@ -1,7 +1,7 @@
{
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.10.0-SNAPSHOT/[artifact]-[revision].[ext]"
def snapshotPattern = "http://repo.typesafe.com/typesafe/scala-tools-snapshots/[organization]/[module]/2.10.0-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
moduleConfigurations += ModuleConfiguration("org.scala-lang", "*", "2.10.0-.*", scalaSnapshots)
}
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110412.015459-17"
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0-20110531.020043-61"

View File

@ -1,5 +1,9 @@
ivyScala ~= { (is: Option[IvyScala]) => is.map(_.copy(checkExplicit = false, overrideScalaVersion = false)) }
ivyScala ~= { (is: Option[IvyScala]) => is.map(_.copy(checkExplicit = false, overrideScalaVersion = false, filterImplicit = false)) }
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
libraryDependencies += "junit" % "junit" % "4.8"
libraryDependencies += "junit" % "junit" % "4.8"
autoScalaLibrary := false
cleanFiles <+= baseDirectory(_ / "ivy-home")

View File

@ -7,14 +7,17 @@ object MultiPublishTest extends Build
organization := "A",
version := "1.0",
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ),
externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
}
externalResolvers <<= baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
)
lazy val root = Project("root", file(".")) settings(
name := "Retrieve Test",
libraryDependencies := if("mavenStyle".asFile.exists) mavenStyleDependencies else ivyStyleDependencies
mavenStyle,
libraryDependencies <<= publishMavenStyle { style => if(style) mavenStyleDependencies else ivyStyleDependencies }
)
lazy val mavenStyle = publishMavenStyle <<= baseDirectory { base => (base / "mavenStyle") exists }
def ivyStyleDependencies = parentDep("A") :: subDep("A") :: subDep("B") ::parentDep("D") :: Nil
def mavenStyleDependencies = parentDep("B") :: parentDep("C") :: subDep("C") :: subDep("D") :: Nil

View File

@ -7,14 +7,15 @@ object MultiPublishTest extends Build
organization := "A",
version := "1.0",
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ),
externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
externalResolvers <<= baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
)
lazy val root = Project("root", file(".")) settings( mavenStyle, name = "Publish Test" )
lazy val root = Project("root", file(".")) dependsOn(sub) aggregate(sub) settings( mavenStyle, interProject, name := "Publish Test" )
lazy val sub = Project("sub", file("sub")) settings( mavenStyle, name = "Sub Project" )
lazy val sub = Project("sub", file("sub")) settings( mavenStyle, name := "Sub Project" )
lazy val mavenStyle = publishMavenStyle <<= baseDirectory { base => (base / "mavenStyle") exists }
override def deliverProjectDependencies = if(managedStyle == sub.managedStyle) super.deliverProjectDependencies else Nil
def interProject =
projectDependencies <<= (publishMavenStyle, publishMavenStyle in sub, projectDependencies) map { (style, subStyle, pd) => if(style == subStyle) pd else Nil }
}

View File

@ -1,15 +1,15 @@
> publish-local
$ touch mavenStyle
> set organization in ThisBuild := "B"
> set organization in ThisBuild :="B"
> publish-local
$ touch sub/mavenStyle
> set organization in ThisBuild := "C"
> set organization in ThisBuild :="C"
> publish-local
$ delete mavenStyle
> set organization := "D"
> set organization in ThisBuild :="D"
> publish-local
> set name := "Retrieve Test"

View File

@ -1,5 +1,6 @@
import sbt._
import Keys._
import classpath.ClasspathUtilities
object TestProject extends Build
{
@ -9,19 +10,17 @@ object TestProject extends Build
TaskKey[Unit]("check-in-compile") <<= checkClasspath(Compile)
)
lazy val checkInTest = checkClasspath(testClasspath)
lazy val checkInCompile = checkClasspath(compileClasspath)
private def checkClasspath(conf: Configuration) =
fullClasspath in conf map { cp =>
try
{
val loader = ClasspathUtilities.toLoader(cp)
val loader = ClasspathUtilities.toLoader(cp.files)
Class.forName("slinky.http.Application", false, loader)
()
}
catch
{
case _: ClassNotFoundException => error("Dependency not downloaded.")
case _: ClassNotFoundException => error("Dependency not downloaded.")
}
}
}

View File

@ -1,7 +1,2 @@
-> check-in-test
-> check-in-compile
> update
> check-in-test
-> check-in-compile