File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,10 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S
140
140
* The document order is preserved.
141
141
*/
142
142
def \\ (that : String ): NodeSeq = {
143
+ def fail = throw new IllegalArgumentException (that)
143
144
def filt (cond : (Node ) => Boolean ) = this flatMap (_.descendant_or_self) filter cond
144
145
that match {
146
+ case " " => fail
145
147
case " _" => filt(! _.isAtom)
146
148
case _ if that(0 ) == '@' => filt(! _.isAtom) flatMap (_ \ that)
147
149
case _ => filt(x => ! x.isAtom && x.label == that)
Original file line number Diff line number Diff line change @@ -145,6 +145,16 @@ class XMLTest {
145
145
assertEquals(expected, actual)
146
146
}
147
147
148
+ @ UnitTest (expected= classOf [IllegalArgumentException ])
149
+ def failEmptyStringChildren : Unit = {
150
+ <x /> \ " "
151
+ }
152
+
153
+ @ UnitTest (expected= classOf [IllegalArgumentException ])
154
+ def failEmptyStringDescendants : Unit = {
155
+ <x /> \\ " "
156
+ }
157
+
148
158
@ UnitTest
149
159
def namespaces : Unit = {
150
160
val cuckoo = <cuckoo xmlns =" http://cuckoo.com" >
You can’t perform that action at this time.
0 commit comments