Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Fix #20: test locally built scala.xml classes #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,21 @@ libraryDependencies += "junit" % "junit" % "4.11" % "test"

libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"

//// testing:
// used in CompilerErrors test
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test"
libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*")

// needed to fix classloader issues (see #20)
// alternatively, manage the scala instance as shown below (commented)
fork in Test := true

// ALTERNATIVE: manage the Scala instance ourselves to exclude the published scala-xml (scala-compiler depends on it)
// since this dependency hides the classes we're testing
// managedScalaInstance := false
//
// ivyConfigurations += Configurations.ScalaTool
//
// libraryDependencies ++= Seq(
// "org.scala-lang" % "scala-library" % scalaVersion.value,
// ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "scala-tool").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}")
// )
5 changes: 5 additions & 0 deletions src/main/scala/scala/xml/XML.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,8 @@ object XML extends XMLLoader[Elem] {
w.write(Utility.serialize(node, minimizeTags = minimizeTags).toString)
}
}

object Properties extends scala.util.PropertiesTrait {
protected def propCategory = "scala-xml"
protected def pickJarBasedOn = classOf[scala.xml.pull.XMLEventReader]
}
5 changes: 5 additions & 0 deletions src/test/scala/scala/xml/CompilerErrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ class CompilerErrors extends CompilerTesting {

// TODO: factor out somewhere?
class CompilerTesting {
// TODO: refine this; for now, just println -- the goal is to ensure we're testing the right version of scala-xml
// (it should print the same thing as the version in the sbt build)
// we used to always test the scala-xml jar that the compiler depends on, because it was part of the scala-tool ivy config
println(s"Testing scala-xml version ${Properties.versionNumberString}.")

def errorMessages(errorSnippet: String, compileOptions: String = "")(code: String): List[String] = {
import scala.tools.reflect._
val m = scala.reflect.runtime.currentMirror
Expand Down