@@ -18,9 +18,6 @@ package org.scalactic
18
18
import scala .collection ._
19
19
import mutable .WrappedArray
20
20
import scala .util .Success
21
- // SKIP-SCALATESTJS,NATIVE-START
22
- import scala .xml
23
- // SKIP-SCALATESTJS,NATIVE-END
24
21
25
22
/**
26
23
* A function that given any object will produce a “pretty” string representation of that object,
@@ -210,11 +207,6 @@ object Prettifier {
210
207
(aGenMap.toIterator.map { case (key, value) => // toIterator is needed for consistent ordering
211
208
apply(key) + " -> " + apply(value)
212
209
}).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
218
210
case aGenTraversable : GenTraversable [_] =>
219
211
val isSelf =
220
212
if (aGenTraversable.size == 1 ) {
@@ -224,13 +216,18 @@ object Prettifier {
224
216
}
225
217
}
226
218
else
227
- false
219
+ false
228
220
if (isSelf)
229
221
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
234
231
case javaCol : java.util.Collection [_] =>
235
232
// By default java collection follows http://download.java.net/jdk7/archive/b123/docs/api/java/util/AbstractCollection.html#toString()
236
233
// let's do our best to prettify its element when it is not overriden
0 commit comments