mirror of https://github.com/sbt/sbt.git
Merge pull request #1487 from sbt/wip/fr-1306
Fixes #1306 - Attempt to turn test suite names into better filenames.
This commit is contained in:
commit
550a7f8e96
|
|
@ -34,6 +34,7 @@
|
||||||
[1476]: https://github.com/sbt/sbt/pull/1476
|
[1476]: https://github.com/sbt/sbt/pull/1476
|
||||||
[1477]: https://github.com/sbt/sbt/pull/1477
|
[1477]: https://github.com/sbt/sbt/pull/1477
|
||||||
[1486]: https://github.com/sbt/sbt/pull/1486
|
[1486]: https://github.com/sbt/sbt/pull/1486
|
||||||
|
[1487]: https://github.com/sbt/sbt/pull/1487
|
||||||
[@dansanduleac]: https://github.com/dansanduleac
|
[@dansanduleac]: https://github.com/dansanduleac
|
||||||
[@2m]: https://github.com/2m
|
[@2m]: https://github.com/2m
|
||||||
[@pvlugter]: https://github.com/pvlugter
|
[@pvlugter]: https://github.com/pvlugter
|
||||||
|
|
@ -78,6 +79,7 @@
|
||||||
- Fixes cross versioning to recognize version number with mutiple -tags. [#1433][1433] by [@henrikengstrom][@henrikengstrom]
|
- Fixes cross versioning to recognize version number with mutiple -tags. [#1433][1433] by [@henrikengstrom][@henrikengstrom]
|
||||||
- Works around "Not a simple type" breaking `-Xfatal-warnings`. [#1477][1477] by [@puffnfresh][@puffnfresh]
|
- Works around "Not a simple type" breaking `-Xfatal-warnings`. [#1477][1477] by [@puffnfresh][@puffnfresh]
|
||||||
- Fixes sLog usage in tandem with the `set` comamnd [#1486][1486] [@jsuereth][@jsuereth]
|
- Fixes sLog usage in tandem with the `set` comamnd [#1486][1486] [@jsuereth][@jsuereth]
|
||||||
|
- Test suites with whitespace will have prettier filenames [#1487][1487] [@jsuereth][@jsuereth]
|
||||||
|
|
||||||
### enablePlugins/disablePlugins
|
### enablePlugins/disablePlugins
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package sbt
|
||||||
|
|
||||||
import java.io.{ StringWriter, PrintWriter, File }
|
import java.io.{ StringWriter, PrintWriter, File }
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
|
|
||||||
import scala.collection.mutable.ListBuffer
|
import scala.collection.mutable.ListBuffer
|
||||||
import scala.util.DynamicVariable
|
import scala.util.DynamicVariable
|
||||||
import scala.xml.{ Elem, Node => XNode, XML }
|
import scala.xml.{ Elem, Node => XNode, XML }
|
||||||
|
|
@ -154,8 +155,12 @@ class JUnitXmlTestsListener(val outputDir: String) extends TestsListener {
|
||||||
writeSuite()
|
writeSuite()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Here we normalize the name to ensure that it's a nicer filename, rather than
|
||||||
|
// contort the user into not using spaces.
|
||||||
|
private[this] def normalizeName(s: String) = s.replaceAll("""\s+""", "-")
|
||||||
|
|
||||||
private def writeSuite() = {
|
private def writeSuite() = {
|
||||||
val file = new File(targetDir, testSuite.value.name + ".xml").getAbsolutePath
|
val file = new File(targetDir, s"${normalizeName(testSuite.value.name)}.xml").getAbsolutePath
|
||||||
// TODO would be nice to have a logger and log this with level debug
|
// TODO would be nice to have a logger and log this with level debug
|
||||||
// System.err.println("Writing JUnit XML test report: " + file)
|
// System.err.println("Writing JUnit XML test report: " + file)
|
||||||
XML.save(file, testSuite.value.stop(), "UTF-8", true, null)
|
XML.save(file, testSuite.value.stop(), "UTF-8", true, null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue