Skip to content

Commit 10f8b59

Browse files
committed
Merge branch '3.1.x-cherry-pick-from-3.0.x-may19' of https://github.com/cheeseng/scalatest into cheeseng-3.1.x-cherry-pick-from-3.0.x-may19
2 parents a0d8284 + da69434 commit 10f8b59

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

project/scalatest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ object ScalatestBuild {
454454
projectTitle := "Scalactic",
455455
organization := "org.scalactic",
456456
initialCommands in console := "import org.scalactic._",
457-
libraryDependencies ++= scalaXmlDependency(scalaVersion.value),
458457
sourceGenerators in Compile += {
459458
Def.task{
460459
GenVersions.genScalacticVersions((sourceManaged in Compile).value / "org" / "scalactic", version.value, scalaVersion.value) ++
@@ -750,6 +749,7 @@ object ScalatestBuild {
750749
initialCommands in console := """|import org.scalatest._
751750
|import org.scalactic._
752751
|import Matchers._""".stripMargin,
752+
libraryDependencies ++= scalaXmlDependency(scalaVersion.value),
753753
libraryDependencies ++= scalatestLibraryDependencies,
754754
genMustMatchersTask,
755755
genGenTask,

scalactic/src/main/scala/org/scalactic/Prettifier.scala

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ package org.scalactic
1818
import scala.collection._
1919
import mutable.WrappedArray
2020
import scala.util.Success
21-
// SKIP-SCALATESTJS,NATIVE-START
22-
import scala.xml
23-
// SKIP-SCALATESTJS,NATIVE-END
2421

2522
/**
2623
* A function that given any object will produce a “pretty” string representation of that object,
@@ -210,11 +207,6 @@ object Prettifier {
210207
(aGenMap.toIterator.map { case (key, value) => // toIterator is needed for consistent ordering
211208
apply(key) + " -> " + apply(value)
212209
}).mkString(", ") + ")"
213-
// SKIP-SCALATESTJS,NATIVE-START
214-
case anXMLNodeSeq: xml.NodeSeq => anXMLNodeSeq.toString
215-
case anXMLNodeBuffer: xml.NodeBuffer =>
216-
xml.NodeSeq.fromSeq(anXMLNodeBuffer).toString
217-
// SKIP-SCALATESTJS,NATIVE-END
218210
case aGenTraversable: GenTraversable[_] =>
219211
val isSelf =
220212
if (aGenTraversable.size == 1) {
@@ -224,13 +216,18 @@ object Prettifier {
224216
}
225217
}
226218
else
227-
false
219+
false
228220
if (isSelf)
229221
aGenTraversable.toString
230-
else
231-
ColCompatHelper.className(aGenTraversable) + "(" + aGenTraversable.toIterator.map(apply(_)).mkString(", ") + ")" // toIterator is needed for consistent ordering
232-
// SKIP-SCALATESTJS,NATIVE-START
233-
222+
else {
223+
val className = aGenTraversable.getClass.getName
224+
if (className.startsWith("scala.xml.NodeSeq$") || className == "scala.xml.NodeBuffer")
225+
aGenTraversable.mkString
226+
else
227+
ColCompatHelper.className(aGenTraversable) + "(" + aGenTraversable.toIterator.map(apply(_)).mkString(", ") + ")" // toIterator is needed for consistent ordering
228+
}
229+
230+
// SKIP-SCALATESTJS-START
234231
case javaCol: java.util.Collection[_] =>
235232
// By default java collection follows http://download.java.net/jdk7/archive/b123/docs/api/java/util/AbstractCollection.html#toString()
236233
// let's do our best to prettify its element when it is not overriden

0 commit comments

Comments
 (0)