Skip to content

Commit

Permalink
Bump version of scala-xml to 2.0.0 (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckipp01 authored Sep 23, 2021
1 parent 8317988 commit b019d87
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ lazy val plugin =
crossTarget := target.value / s"scala-${scalaVersion.value}",
crossVersion := CrossVersion.full,
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % "1.3.0",
"org.scala-lang.modules" %% "scala-xml" % "2.0.0",
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ package scoverage
import java.io.File
import java.util.UUID
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.parsers.SAXParserFactory

import scala.xml.Elem
import scala.xml.XML
import scala.xml.factory.XMLLoader

import org.scalatest.BeforeAndAfter
import org.scalatest.OneInstancePerTest
Expand Down Expand Up @@ -314,7 +317,17 @@ class CoberturaXmlWriterTest
val writer = new CoberturaXmlWriter(sourceRoot, dir)
writer.write(coverage)

val xml = XML.loadFile(fileIn(dir))
// Needed to acount for https://github.com/scala/scala-xml/pull/177
val customXML: XMLLoader[Elem] = XML.withSAXParser {
val factory = SAXParserFactory.newInstance()
factory.setFeature(
"http://apache.org/xml/features/nonvalidating/load-external-dtd",
false
)
factory.newSAXParser()
}

val xml = customXML.loadFile(fileIn(dir))

assert((xml \\ "coverage" \ "@line-rate").text === "0.33", "line-rate")
assert((xml \\ "coverage" \ "@branch-rate").text === "0.50", "branch-rate")
Expand Down

0 comments on commit b019d87

Please sign in to comment.