File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 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
140140 * The document order is preserved.
141141 */
142142 def \\ (that : String ): NodeSeq = {
143+ def fail = throw new IllegalArgumentException (that)
143144 def filt (cond : (Node ) => Boolean ) = this flatMap (_.descendant_or_self) filter cond
144145 that match {
146+ case " " => fail
145147 case " _" => filt(! _.isAtom)
146148 case _ if that(0 ) == '@' => filt(! _.isAtom) flatMap (_ \ that)
147149 case _ => filt(x => ! x.isAtom && x.label == that)
Original file line number Diff line number Diff line change @@ -145,6 +145,16 @@ class XMLTest {
145145 assertEquals(expected, actual)
146146 }
147147
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+
148158 @ UnitTest
149159 def namespaces : Unit = {
150160 val cuckoo = <cuckoo xmlns =" http://cuckoo.com" >
You can’t perform that action at this time.
0 commit comments