mirror of https://github.com/sbt/sbt.git
updating more integration tests
This commit is contained in:
parent
4f4ae170d3
commit
a68e4c74f9
|
|
@ -14,6 +14,10 @@ package org.example {
|
|||
abstract class Child extends Parent[String]
|
||||
class S {
|
||||
def x = new { def y = new S { def z = new Child { def x = "asdf" } } }
|
||||
final val xconst = 3
|
||||
private[this] def zz: Seq[_] = Nil
|
||||
type L[M[_], P <: Int >: Int] = M[P]
|
||||
type Q = L[Option, Int]
|
||||
}
|
||||
object Basic
|
||||
trait Out {
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ object CompileTest extends Specification
|
|||
WithCompiler( "2.7.5" )(testCompileAnalysis)
|
||||
WithCompiler( "2.7.7" )(testCompileAnalysis)
|
||||
WithCompiler( "2.8.0" )(testCompileAnalysis)
|
||||
WithCompiler( "2.8.1.RC2" )(testCompileAnalysis)
|
||||
WithCompiler( "2.8.1" )(testCompileAnalysis)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
"Raw compiler" should {
|
||||
"Properly handle classpaths" in {
|
||||
testClasspath("2.7.2")
|
||||
testClasspath("2.7.7")
|
||||
testClasspath("2.8.0")
|
||||
testClasspath("2.8.1.RC2")
|
||||
testClasspath("2.8.1")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -43,9 +43,16 @@ object CompileTest extends Specification
|
|||
|
||||
private def shouldFail(act: => Unit) =
|
||||
{
|
||||
val success = try { act; true } catch { case e: Exception => false }
|
||||
val success = try { act; true } catch { case t if expectedException(t) => false }
|
||||
if(success) error("Expected exception not thrown")
|
||||
}
|
||||
private def expectedException(t: Throwable) =
|
||||
t match
|
||||
{
|
||||
case e: Exception => true
|
||||
case t if isMissingRequirementError(t) => true
|
||||
case _ => false
|
||||
}
|
||||
private def isMissingRequirementError(t: Throwable) = t.getClass.getName == "scala.tools.nsc.MissingRequirementError"
|
||||
private def testClasspath(scalaVersion: String) =
|
||||
WithCompiler.launcher { (launch, log) =>
|
||||
|
|
@ -76,6 +83,10 @@ object CompileTest extends Specification
|
|||
shouldFail( fullExplicit(compSrcs, Nil, out, Nil) )// failure
|
||||
fullExplicit(plainSrcs, Nil, out, fullBoot) // success
|
||||
fullExplicit(compSrcs, withCompiler, out, fullBoot) // success
|
||||
|
||||
// specs now marks something as skipped if there are no matchers
|
||||
// this test throws exceptions on failure, so use a dummy check here
|
||||
true must be equalTo(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ object EvalTest extends Properties("eval")
|
|||
val value = result.value.asInstanceOf[{def i: Int}].i
|
||||
(label("Value", value) |: (value == i)) &&
|
||||
(label("Type", result.tpe) |: (result.tpe == LocalType)) &&
|
||||
(label("Module name", result.enclosingModule) |: (result.enclosingModule == ModuleName)) &&
|
||||
(label("Files", result.generated) |: (!result.generated.isEmpty))
|
||||
}
|
||||
}
|
||||
|
|
@ -71,7 +70,6 @@ object EvalTest extends Properties("eval")
|
|||
}
|
||||
val IntType = "Int"
|
||||
val BooleanType = "Boolean"
|
||||
val ModuleName = "$c1f67bf3eebc642f70dd"
|
||||
|
||||
def label(s: String, value: Any) = s + " (" + value + ")"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,13 +38,14 @@ object Console
|
|||
}
|
||||
def sbt(state: State, extra: String)(implicit log: Logger)
|
||||
{
|
||||
val loader = classOf[State].getClassLoader
|
||||
val extracted = Project extract state
|
||||
val bindings = ("state" -> state) :: ("extracted" -> extracted ) :: Nil
|
||||
val unit = extracted.currentUnit
|
||||
val compiler = Compile.compilers(state.configuration, log).scalac
|
||||
val imports = Load.getImports(unit.unit).mkString("", ";\n", ";\n\n")
|
||||
val initCommands = imports + extra
|
||||
val bindings = ("state" -> state) :: ("extracted" -> extracted ) :: Nil
|
||||
val imports = Load.getImports(unit.unit) ++ Load.importAll(bindings.map(_._1))
|
||||
val importString = imports.mkString("", ";\n", ";\n\n")
|
||||
val initCommands = importString + extra
|
||||
val loader = classOf[State].getClassLoader
|
||||
(new Console(compiler))(unit.classpath, Nil, initCommands)(Some(loader), bindings)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,11 @@ object Keys
|
|||
val DiscoveredMainClasses = TaskKey[Seq[String]]("discovered-main-classes")
|
||||
val Runner = SettingKey[ScalaRun]("runner")
|
||||
|
||||
val Fork = SettingKey[Boolean]("fork")
|
||||
val OutputStrategy = SettingKey[Option[sbt.OutputStrategy]]("output-strategy")
|
||||
val JavaHome = SettingKey[Option[File]]("java-home")
|
||||
val JavaOptions = SettingKey[Seq[String]]("java-options")
|
||||
|
||||
// Test Keys
|
||||
val TestLoader = TaskKey[ClassLoader]("test-loader")
|
||||
val LoadedTestFrameworks = TaskKey[Map[TestFramework,Framework]]("loaded-test-frameworks")
|
||||
|
|
@ -202,7 +207,11 @@ object Default
|
|||
def analysisMap[T](cp: Seq[Attributed[T]]): Map[T, Analysis] =
|
||||
(cp map extractAnalysis).toMap
|
||||
|
||||
def core = Seq(
|
||||
def core: Seq[Setting[_]] = Seq(
|
||||
JavaHome in GlobalScope :== None,
|
||||
OutputStrategy in GlobalScope :== None,
|
||||
Fork in GlobalScope :== false,
|
||||
JavaOptions in GlobalScope :== Nil,
|
||||
CrossPaths :== true,
|
||||
ShellPrompt in GlobalScope :== (_ => "> "),
|
||||
Aggregate in GlobalScope :== Aggregation.Enabled,
|
||||
|
|
@ -241,7 +250,6 @@ object Default
|
|||
def addBaseSources = Seq(
|
||||
Sources <<= (Sources, Base, SourceFilter, DefaultExcludes) map { (srcs,b,f,excl) => (srcs +++ b * (f -- excl)).getFiles.toSeq }
|
||||
)
|
||||
lazy val configTasks = Classpaths.configSettings ++ baseTasks
|
||||
|
||||
def webPaths = Seq(
|
||||
WebappDir <<= Source / "webapp"
|
||||
|
|
@ -256,24 +264,24 @@ object Default
|
|||
Target <<= (Target, ScalaInstance, CrossPaths)( (t,si,cross) => if(cross) t / ("scala-" + si.actualVersion) else t )
|
||||
)
|
||||
|
||||
def baseTasks = Seq(
|
||||
lazy val configTasks = Seq(
|
||||
InitialCommands in GlobalScope :== "",
|
||||
CompileTask <<= compileTask,
|
||||
CompileInputs <<= compileInputsTask,
|
||||
ConsoleTask <<= console,
|
||||
ConsoleQuick <<= consoleQuick,
|
||||
DiscoveredMainClasses <<= CompileTask map discoverMainClasses,
|
||||
Runner <<= ScalaInstance( si => new Run(si) ),
|
||||
inTask(RunTask)(runner :: Nil).head,
|
||||
SelectMainClass <<= DiscoveredMainClasses map selectRunMain,
|
||||
MainClass in RunTask :== SelectMainClass,
|
||||
MainClass <<= DiscoveredMainClasses map selectPackageMain,
|
||||
RunTask <<= runTask(FullClasspath, MainClass in RunTask),
|
||||
RunTask <<= runTask(FullClasspath, MainClass in RunTask, Runner in RunTask),
|
||||
ScaladocOptions <<= ScalacOptions(identity),
|
||||
DocTask <<= docTask,
|
||||
CopyResources <<= copyResources
|
||||
)
|
||||
|
||||
lazy val projectTasks = Seq(
|
||||
lazy val projectTasks: Seq[Setting[_]] = Seq(
|
||||
CleanFiles <<= (Target, SourceManaged) { _ :: _ :: Nil },
|
||||
Clean <<= CleanFiles map IO.delete,
|
||||
ConsoleProject <<= consoleProject
|
||||
|
|
@ -289,14 +297,14 @@ object Default
|
|||
frameworks.flatMap(f => f.create(loader, s.log).map( x => (f,x)).toIterable).toMap
|
||||
},
|
||||
DefinedTests <<= (LoadedTestFrameworks, CompileTask, streams) map { (frameworkMap, analysis, s) =>
|
||||
val tests = Test.discover(frameworkMap.values.toSeq, analysis)._1
|
||||
val tests = Test.discover(frameworkMap.values.toSeq, analysis, s.log)._1
|
||||
IO.writeLines(s.text(CompletionsID), tests.map(_.name).distinct)
|
||||
tests
|
||||
},
|
||||
TestListeners <<= (streams in TestTask) map ( s => TestLogger(s.log) :: Nil ),
|
||||
TestOptions <<= TestListeners map { listeners => Test.Listeners(listeners) :: Nil },
|
||||
ExecuteTests <<= (streams in TestTask, LoadedTestFrameworks, TestOptions, TestLoader, DefinedTests, CopyResources) flatMap {
|
||||
(s, frameworkMap, options, loader, discovered, _) => Test(frameworkMap, loader, discovered, options, s.log)
|
||||
ExecuteTests <<= (streams in TestTask, LoadedTestFrameworks, TestOptions, TestLoader, DefinedTests) flatMap {
|
||||
(s, frameworkMap, options, loader, discovered) => Test(frameworkMap, loader, discovered, options, s.log)
|
||||
},
|
||||
TestTask <<= (ExecuteTests, streams) map { (results, s) => Test.showResults(s.log, results) },
|
||||
TestOnly <<= testOnly
|
||||
|
|
@ -304,15 +312,14 @@ object Default
|
|||
|
||||
def testOnly =
|
||||
InputTask(resolvedScoped(testOnlyParser)) ( result =>
|
||||
(streams, LoadedTestFrameworks, TestOptions, TestLoader, DefinedTests, CopyResources, result) flatMap {
|
||||
case (s, frameworks, opts, loader, discovered, _, (tests, frameworkOptions)) =>
|
||||
(streams, LoadedTestFrameworks, TestOptions, TestLoader, DefinedTests, result) flatMap {
|
||||
case (s, frameworks, opts, loader, discovered, (tests, frameworkOptions)) =>
|
||||
val modifiedOpts = Test.Filter(if(tests.isEmpty) _ => true else tests.toSet ) +: Test.Argument(frameworkOptions : _*) +: opts
|
||||
Test(frameworks, loader, discovered, modifiedOpts, s.log) map { results =>
|
||||
Test.showResults(s.log, results)
|
||||
}
|
||||
}
|
||||
)
|
||||
lazy val packageDefaults = packageBase ++ inConfig(CompileConf)(packageConfig) ++ inConfig(TestConf)(packageConfig)
|
||||
|
||||
lazy val packageBase = Seq(
|
||||
jarName,
|
||||
|
|
@ -370,14 +377,23 @@ object Default
|
|||
def selectPackageMain(classes: Seq[String]): Option[String] =
|
||||
sbt.SelectMainClass(None, classes)
|
||||
|
||||
def runTask(classpath: ScopedTask[Classpath], mainClass: ScopedTask[Option[String]]): Initialize[InputTask[Unit]] =
|
||||
def runTask(classpath: ScopedTask[Classpath], mainClass: ScopedTask[Option[String]], run: ScopedSetting[ScalaRun]): Initialize[InputTask[Unit]] =
|
||||
InputTask(_ => complete.Parsers.spaceDelimited("<arg>")) { result =>
|
||||
(classpath, mainClass, Runner, streams, CopyResources, result) map { (cp, main, runner, s, _, args) =>
|
||||
(classpath, mainClass, run, streams, result) map { (cp, main, runner, s, args) =>
|
||||
val mainClass = main getOrElse error("No main class detected.")
|
||||
runner.run(mainClass, data(cp), args, s.log) foreach error
|
||||
}
|
||||
}
|
||||
|
||||
def runner =
|
||||
Runner <<= (ScalaInstance, Base, JavaOptions, OutputStrategy, Fork, JavaHome) { (si, base, options, strategy, fork, javaHome) =>
|
||||
if(fork) {
|
||||
new ForkRun( ForkOptions(scalaJars = si.jars, javaHome = javaHome, outputStrategy = strategy,
|
||||
runJVMOptions = options, workingDirectory = Some(base)) )
|
||||
} else
|
||||
new Run(si)
|
||||
}
|
||||
|
||||
def docTask: Initialize[Task[File]] =
|
||||
(CompileInputs, streams, DocDirectory, Config, ScaladocOptions) map { (in, s, target, config, options) =>
|
||||
val d = new Scaladoc(in.config.maxErrors, in.compilers.scalac)
|
||||
|
|
@ -385,7 +401,7 @@ object Default
|
|||
target
|
||||
}
|
||||
|
||||
def mainRunTask = RunTask <<= runTask(FullClasspath in Configurations.Runtime, MainClass in RunTask)
|
||||
def mainRunTask = RunTask <<= runTask(FullClasspath in Configurations.Runtime, MainClass in RunTask, Runner in RunTask)
|
||||
|
||||
def discoverMainClasses(analysis: Analysis): Seq[String] =
|
||||
compile.Discovery.applications(Test.allDefs(analysis)) collect { case (definition, discovered) if(discovered.hasMain) => definition.name }
|
||||
|
|
@ -448,29 +464,27 @@ object Default
|
|||
def inScope(scope: Scope)(ss: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||
Project.transform(Scope.replaceThis(scope), ss)
|
||||
|
||||
lazy val defaultPaths = paths ++ inConfig(CompileConf)(configPaths ++ addBaseSources) ++ inConfig(TestConf)(configPaths)
|
||||
lazy val defaultWebPaths = defaultPaths ++ inConfig(CompileConf)(webPaths)
|
||||
lazy val defaultWebPaths = inConfig(CompileConf)(webPaths)
|
||||
|
||||
def noAggregation = Seq(RunTask, ConsoleTask, ConsoleQuick)
|
||||
lazy val disableAggregation = noAggregation map disableAggregate
|
||||
def disableAggregate(k: Scoped) =
|
||||
Aggregate in Scope.GlobalScope.copy(task = Select(k.key)) :== false
|
||||
|
||||
lazy val defaultTasks =
|
||||
projectTasks ++
|
||||
inConfig(CompileConf)(configTasks :+ mainRunTask) ++
|
||||
inConfig(TestConf)(configTasks ++ testTasks) ++
|
||||
packageDefaults
|
||||
lazy val baseTasks: Seq[Setting[_]] = projectTasks ++ packageBase
|
||||
|
||||
lazy val defaultWebTasks = Nil
|
||||
|
||||
lazy val defaultClasspaths =
|
||||
Classpaths.publishSettings ++ Classpaths.baseSettings ++
|
||||
inConfig(CompileConf)(Classpaths.configSettings) ++
|
||||
inConfig(TestConf)(Classpaths.configSettings)
|
||||
lazy val baseClasspaths = Classpaths.publishSettings ++ Classpaths.baseSettings
|
||||
lazy val configSettings = Classpaths.configSettings ++ configTasks ++ configPaths ++ packageConfig
|
||||
|
||||
lazy val compileSettings = configSettings ++ (mainRunTask +: addBaseSources)
|
||||
lazy val testSettings = configSettings ++ testTasks
|
||||
|
||||
lazy val defaultSettings = core ++ defaultPaths ++ defaultClasspaths ++ defaultTasks ++ compileBase ++ disableAggregation
|
||||
lazy val itSettings = inConfig(Configurations.IntegrationTest)(testSettings)
|
||||
lazy val defaultConfigs = inConfig(CompileConf)(compileSettings) ++ inConfig(TestConf)(testSettings)
|
||||
|
||||
lazy val defaultSettings: Seq[Setting[_]] = core ++ paths ++ baseClasspaths ++ baseTasks ++ compileBase ++ defaultConfigs ++ disableAggregation
|
||||
lazy val defaultWebSettings = defaultSettings ++ defaultWebPaths ++ defaultWebTasks
|
||||
}
|
||||
object Classpaths
|
||||
|
|
@ -484,7 +498,7 @@ object Classpaths
|
|||
|
||||
def concat[T](a: ScopedTaskable[Seq[T]], b: ScopedTaskable[Seq[T]]): Initialize[Task[Seq[T]]] = (a,b) map (_ ++ _)
|
||||
|
||||
val configSettings: Seq[Project.Setting[_]] = Seq(
|
||||
lazy val configSettings: Seq[Project.Setting[_]] = Seq(
|
||||
ExternalDependencyClasspath <<= concat(UnmanagedClasspath, ManagedClasspath),
|
||||
DependencyClasspath <<= concat(InternalDependencyClasspath, ExternalDependencyClasspath),
|
||||
FullClasspath <<= concat(Products, DependencyClasspath),
|
||||
|
|
@ -642,7 +656,7 @@ object Classpaths
|
|||
|
||||
def analyzed[T](data: T, analysis: Analysis) = Attributed.blank(data).put(Command.Analysis, analysis)
|
||||
def makeProducts: Initialize[Task[Classpath]] =
|
||||
(CompileTask, CompileInputs) map { (analysis, i) => analyzed(i.config.classesDirectory, analysis) :: Nil }
|
||||
(CompileTask, CompileInputs, CopyResources) map { (analysis, i, _) => analyzed(i.config.classesDirectory, analysis) :: Nil }
|
||||
|
||||
def internalDependencies: Initialize[Task[Classpath]] =
|
||||
(ThisProjectRef, ThisProject, Config, Data) flatMap internalDependencies0
|
||||
|
|
|
|||
|
|
@ -104,18 +104,20 @@ object Test
|
|||
(overall(results.map(_._2)), results.toMap)
|
||||
def overall(results: Iterable[TestResult.Value]): TestResult.Value =
|
||||
(TestResult.Passed /: results) { (acc, result) => if(acc.id < result.id) result else acc }
|
||||
def discover(frameworks: Seq[Framework], analysis: Analysis): (Seq[TestDefinition], Set[String]) =
|
||||
discover(frameworks.flatMap(_.tests), allDefs(analysis))
|
||||
def discover(frameworks: Seq[Framework], analysis: Analysis, log: Logger): (Seq[TestDefinition], Set[String]) =
|
||||
discover(frameworks.flatMap(_.tests), allDefs(analysis), log)
|
||||
|
||||
def allDefs(analysis: Analysis) = analysis.apis.internal.values.flatMap(_.definitions).toSeq
|
||||
def discover(fingerprints: Seq[Fingerprint], definitions: Seq[Definition]): (Seq[TestDefinition], Set[String]) =
|
||||
def discover(fingerprints: Seq[Fingerprint], definitions: Seq[Definition], log: Logger): (Seq[TestDefinition], Set[String]) =
|
||||
{
|
||||
val subclasses = fingerprints collect { case sub: SubclassFingerprint => (sub.superClassName, sub.isModule, sub) };
|
||||
val annotations = fingerprints collect { case ann: AnnotatedFingerprint => (ann.annotationName, ann.isModule, ann) };
|
||||
log.debug("Subclass fingerprints: " + subclasses)
|
||||
log.debug("Annotation fingerprints: " + annotations)
|
||||
|
||||
def firsts[A,B,C](s: Seq[(A,B,C)]): Set[A] = s.map(_._1).toSet
|
||||
def defined(in: Seq[(String,Boolean,Fingerprint)], names: Set[String], isModule: Boolean): Seq[Fingerprint] =
|
||||
in collect { case (name, mod, print) if names(name) && isModule == mod => print }
|
||||
def defined(in: Seq[(String,Boolean,Fingerprint)], names: Set[String], IsModule: Boolean): Seq[Fingerprint] =
|
||||
in collect { case (name, IsModule, print) if names(name) => print }
|
||||
|
||||
def toFingerprints(d: Discovered): Seq[Fingerprint] =
|
||||
defined(subclasses, d.baseClasses, d.isModule) ++
|
||||
|
|
|
|||
|
|
@ -5,20 +5,21 @@ package sbt
|
|||
|
||||
import java.io.{File,OutputStream}
|
||||
|
||||
abstract class ForkJava extends NotNull
|
||||
trait ForkJava
|
||||
{
|
||||
def javaHome: Option[File] = None
|
||||
def outputStrategy: Option[OutputStrategy] = None
|
||||
def javaHome: Option[File]
|
||||
def outputStrategy: Option[OutputStrategy]
|
||||
}
|
||||
abstract class ForkScala extends ForkJava
|
||||
trait ForkScala extends ForkJava
|
||||
{
|
||||
def scalaJars: Iterable[File] = Nil
|
||||
def scalaJars: Iterable[File]
|
||||
}
|
||||
trait ForkScalaRun extends ForkScala
|
||||
{
|
||||
def workingDirectory: Option[File] = None
|
||||
def runJVMOptions: Seq[String] = Nil
|
||||
def workingDirectory: Option[File]
|
||||
def runJVMOptions: Seq[String]
|
||||
}
|
||||
final case class ForkOptions(javaHome: Option[File] = None, outputStrategy: Option[OutputStrategy] = None, scalaJars: Iterable[File] = Nil, workingDirectory: Option[File] = None, runJVMOptions: Seq[String] = Nil) extends ForkScalaRun
|
||||
|
||||
sealed abstract class OutputStrategy extends NotNull
|
||||
case object StdoutOutput extends OutputStrategy
|
||||
|
|
|
|||
|
|
@ -2,5 +2,8 @@ $ mkdir sub3 sub1 sub2
|
|||
> console-project
|
||||
> 'sub3/console-project'
|
||||
> 'sub1/console-project'
|
||||
|
||||
> project sub2
|
||||
# This can't actually fail, unfortunately. The repl traps the exception and continues normally.
|
||||
> 'set InitialCommands :== """assert((Name in currentRef get structure.data) == Some("sub2")) """ '
|
||||
> console-project
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#Project properties
|
||||
#Tue Feb 17 21:42:42 EST 2009
|
||||
project.name=Properties Subproject Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class TestProject(info: ProjectInfo) extends ParentProject(info)
|
||||
{
|
||||
val a = project("a", "Sub project A")
|
||||
val b = project("b", "Sub project B")
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
> project Sub project A
|
||||
> get sbt.version
|
||||
$ absent a/project
|
||||
$ absent b/project
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#Project properties
|
||||
#Tue Feb 17 21:42:42 EST 2009
|
||||
project.name=Properties Subproject Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class TestProject(info: ProjectInfo) extends ParentProject(info)
|
||||
{
|
||||
val a = subproject("a", "Sub project A")
|
||||
val b = subproject("b", "Sub project B")
|
||||
|
||||
private def subproject(path: Path, name: String) = project(path, name, new TestSubProject(_))
|
||||
|
||||
class TestSubProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
> project Sub project A
|
||||
> get sbt.version
|
||||
$ absent a/project
|
||||
$ absent b/project
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#Project properties
|
||||
#Tue Dec 22 16:14:08 CST 2009
|
||||
project.organization=Cough
|
||||
project.name=ForkFail
|
||||
project.version=1.0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class ForkFailProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||
override def fork = forkRun
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
object ForkFail {
|
||||
def main(args:Array[String]) {
|
||||
println(scala.util.Properties.versionString)
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
> ++2.8.0.Beta1-RC6 run
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class BlankProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
> console-project
|
||||
$ copy-file changes/BlankProject.scala project/build/BlankProject.scala
|
||||
> reload
|
||||
> console-project
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.version=1.0
|
||||
project.name=Daemon Thread Test
|
||||
project.organization=sbt
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.version=1.0
|
||||
project.name=Daemon Thread Test
|
||||
project.organization=sbt
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Test Run Errors
|
||||
project.version=10.0
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
object ForkTest {
|
||||
def main(args:Array[String]) {
|
||||
val cwd = (new java.io.File("flag")).getAbsoluteFile
|
||||
cwd.getParentFile.mkdirs()
|
||||
cwd.createNewFile()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
> run "fork"
|
||||
$ exists flag
|
||||
$ delete flag
|
||||
|
||||
$ mkdir "forked"
|
||||
> set Keys.Fork :== true
|
||||
> 'set Base in RunTask <<= Base(_ / "forked")'
|
||||
|
||||
> run "forked"
|
||||
$ exists forked/flag
|
||||
$ absent flag
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.version=1.0
|
||||
project.name=Daemon Thread Test
|
||||
project.organization=sbt
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.version=1.0
|
||||
project.name=Daemon Thread Test
|
||||
project.organization=sbt
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd">
|
||||
<info organisation="sbt" module="resources-test"/>
|
||||
<configurations>
|
||||
<conf name="test"/>
|
||||
</configurations>
|
||||
<dependencies>
|
||||
<dependency org="org.specs" name="specs" rev="1.4.1" transitive="false" conf="test->default"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#Project properties
|
||||
#Tue Mar 24 17:40:29 EDT 2009
|
||||
project.organization=empty
|
||||
project.name=class-forname
|
||||
project.version=1.0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class TestProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def disableCrossPaths = true
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package lib
|
||||
|
||||
object Test
|
||||
{
|
||||
def other = Class.forName("lib.OtherTest")
|
||||
def otherThread = Class.forName("lib.OtherTest2", true, Thread.currentThread.getContextClassLoader)
|
||||
}
|
||||
|
||||
class OtherTest
|
||||
class OtherTest2
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package test
|
||||
|
||||
import org.specs._
|
||||
|
||||
object TestSpecification extends Specification
|
||||
{
|
||||
"Class.forName must work in libraries used in tests" in {
|
||||
val a: AnyRef = lib.Test.other
|
||||
a must notBe(null)
|
||||
}
|
||||
"Class.forName using Thread.getContextLoader must work in libraries used in tests" in {
|
||||
val a: AnyRef = lib.Test.otherThread
|
||||
a must notBe(null)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# Create a jar that contains two classes: Test and OtherTest
|
||||
# Test loads OtherTest using Class.forName
|
||||
> package
|
||||
|
||||
# get the specs jar
|
||||
> update
|
||||
|
||||
# copy to the lib_managed/test directory to simulate
|
||||
# a library on the 'test' configuration
|
||||
$ copy-file target/class-forname-1.0.jar lib_managed/test/forname.jar
|
||||
|
||||
# Remove the classes that created the jar
|
||||
$ delete src/main/ target/
|
||||
|
||||
# Compile and run the test that calls into the jar created above
|
||||
# It won't succeed if something is messed up with class loading
|
||||
> test
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
LibraryDependencies += "org.scalatest" % "scalatest" % "1.3"
|
||||
|
||||
TestOptions in Configurations.Test ++= {
|
||||
def args(path: String, args: String*): Seq[TestOption] = if(file(path).exists) Test.Argument(args : _*) :: Nil else Nil
|
||||
//
|
||||
args("success1", "-n", "test2 test3") ++
|
||||
args("success2", "-n", "test2") ++
|
||||
args("success3", "-n", "test3") ++
|
||||
args("failure1", "-n", "test1") ++
|
||||
args("failure2", "-n", "test1 test4") ++
|
||||
args("failure3", "-n", "test1 test3")
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Test Arguments Test
|
||||
project.version=1.0
|
||||
|
|
@ -2,8 +2,7 @@ import sbt._
|
|||
|
||||
class ArgumentTest(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
val snap = ScalaToolsSnapshots
|
||||
val st = "org.scalatest" % "scalatest" % "1.0.1-for-scala-2.8.0.Beta1-RC7-with-test-interfaces-0.3-SNAPSHOT"
|
||||
val st = "org.scalatest" % "scalatest" % "1.3"
|
||||
|
||||
override def testOptions =
|
||||
super.testOptions ++
|
||||
|
|
|
|||
|
|
@ -1,29 +1,26 @@
|
|||
> ++2.8.0.Beta1-RC7
|
||||
> update
|
||||
|
||||
# should fail because it should run all tests, some of which are expected to fail (1 and 4)
|
||||
-> test
|
||||
# should fail because it should run all test:tests, some of which are expected to fail (1 and 4)
|
||||
-> test:test
|
||||
|
||||
$ touch success1
|
||||
> test
|
||||
> test:test
|
||||
$ delete success1
|
||||
|
||||
$ touch failure1
|
||||
-> test
|
||||
-> test:test
|
||||
$ delete failure1
|
||||
|
||||
$ touch success2
|
||||
> test
|
||||
> test:test
|
||||
$ delete success2
|
||||
|
||||
$ touch failure2
|
||||
-> test
|
||||
-> test:test
|
||||
$ delete failure2
|
||||
|
||||
$ touch success3
|
||||
> test
|
||||
> test:test
|
||||
$ delete success3
|
||||
|
||||
$ touch failure3
|
||||
-> test
|
||||
-> test:test
|
||||
$ delete failure3
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
class B extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"not work" in { 1 must_== 2 }
|
||||
}
|
||||
"not work" in { 1 must_== 2 }
|
||||
}
|
||||
}
|
||||
|
||||
object A extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"not work" in { 1 must_== 2 }
|
||||
}
|
||||
"not work" in { 1 must_== 2 }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"not work" in { 1 must_== 2 }
|
||||
class B extends Specification
|
||||
{
|
||||
"'hello world' has 11 characters" in {
|
||||
"hello world".size must be equalTo(122)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
class B extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"work" in { 1 must_== 1 }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
class B extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"work" in { 1 must_== 1 }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object B extends Build
|
||||
{
|
||||
lazy val projects = Seq(root)
|
||||
lazy val root =
|
||||
Project("root", file("."))
|
||||
.configs( it )
|
||||
.settings( LibraryDependencies += specs )
|
||||
.settings( Default.itSettings : _*)
|
||||
|
||||
lazy val it = Configurations.IntegrationTest
|
||||
lazy val specs = "org.scala-tools.testing" %% "specs" % "1.6.7.2" % "it,test" intransitive()
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Specs Test Type Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class TestProject(info: ProjectInfo) extends DefaultProject(info) with BasicScalaIntegrationTesting
|
||||
{
|
||||
val specs = "org.scala-tools.testing" %% "specs" % "1.6.1" intransitive()
|
||||
}
|
||||
|
|
@ -1,24 +1,20 @@
|
|||
#> ++2.8.0.Beta1-RC7
|
||||
> ++2.7.7
|
||||
> update
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassFailModuleSuccess.scala src/it/scala/Test.scala
|
||||
-> integration-test
|
||||
-> it:test
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassFailModuleFail.scala src/it/scala/Test.scala
|
||||
-> integration-test
|
||||
-> it:test
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassSuccessModuleFail.scala src/it/scala/Test.scala
|
||||
-> integration-test
|
||||
-> it:test
|
||||
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassSuccessModuleSuccess.scala src/it/scala/Test.scala
|
||||
> integration-test
|
||||
> it:test
|
||||
|
|
@ -0,0 +1 @@
|
|||
LibraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" intransitive()
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd">
|
||||
<info organisation="sbt" module="resources-test"/>
|
||||
<dependencies>
|
||||
<dependency org="org.specs" name="specs" rev="1.4.1" transitive="false" conf="default"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#Project properties
|
||||
project.name=Resources Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,2 +1 @@
|
|||
> update
|
||||
> test
|
||||
> test:test
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Specs Compatibility Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class CompatSpecsTest(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
val specs = "org.scala-tools.testing" % "specs" % "1.6.0" % "test"
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
LibraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" intransitive()
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
class B extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"not work" in { 1 must_== 2 }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
class B extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"not work" in { 1 must_== 2 }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
class B extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"work" in { 1 must_== 1 }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import org.specs._
|
||||
|
||||
class A extends Specification
|
||||
class B extends Specification
|
||||
{
|
||||
"this" should {
|
||||
"work" in { 1 must_== 1 }
|
||||
|
|
|
|||
|
|
@ -1,24 +1,20 @@
|
|||
#> ++2.8.0.Beta1-RC7
|
||||
> ++2.7.7
|
||||
> update
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassFailModuleSuccess.scala src/test/scala/Test.scala
|
||||
-> test
|
||||
-> test:test
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassFailModuleFail.scala src/test/scala/Test.scala
|
||||
-> test
|
||||
-> test:test
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassSuccessModuleFail.scala src/test/scala/Test.scala
|
||||
-> test
|
||||
-> test:test
|
||||
|
||||
|
||||
> clean
|
||||
$ delete src/
|
||||
$ copy-file changes/ClassSuccessModuleSuccess.scala src/test/scala/Test.scala
|
||||
> test
|
||||
> test:test
|
||||
|
|
@ -36,7 +36,7 @@ class TestFramework(val implClassName: String) extends NotNull
|
|||
}
|
||||
final class TestDefinition(val name: String, val fingerprint: Fingerprint) extends NotNull
|
||||
{
|
||||
override def toString = "Test " + name + " : " + fingerprint
|
||||
override def toString = "Test " + name + " : " + TestFramework.toString(fingerprint)
|
||||
override def equals(t: Any) =
|
||||
t match
|
||||
{
|
||||
|
|
@ -115,6 +115,13 @@ object TestFramework
|
|||
case (a: AnnotatedFingerprint, b: AnnotatedFingerprint) => a.isModule == b.isModule && a.annotationName == b.annotationName
|
||||
case _ => false
|
||||
}
|
||||
def toString(f: Fingerprint): String =
|
||||
f match
|
||||
{
|
||||
case sf: SubclassFingerprint => "subclass(" + sf.isModule + ", " + sf.superClassName + ")"
|
||||
case af: AnnotatedFingerprint => "annotation(" + af.isModule + ", " + af.annotationName + ")"
|
||||
case _ => f.toString
|
||||
}
|
||||
|
||||
def testTasks(frameworks: Seq[Framework],
|
||||
testLoader: ClassLoader,
|
||||
|
|
|
|||
|
|
@ -35,5 +35,10 @@ object NameFilterSpecification extends Properties("NameFilter")
|
|||
|
||||
/** Raw control characters are stripped because they are not allowed in expressions.
|
||||
* Asterisks are stripped because they are added under the control of the tests.*/
|
||||
private def stripAsterisksAndControl(s: String) = s.filter(c => !java.lang.Character.isISOControl(c) && c != '*').toString
|
||||
private def stripAsterisksAndControl(s: String) = (s filter validChar).toString
|
||||
private[this] def validChar(c: Char) =
|
||||
!java.lang.Character.isISOControl(c) &&
|
||||
c != '*' &&
|
||||
!Character.isHighSurrogate(c) &&
|
||||
!Character.isLowSurrogate(c)
|
||||
}
|
||||
Loading…
Reference in New Issue