Commit 9a0db27
committed
Fix failure for empty attribute match
Running the following invalid attribute search, properly throws an
IllegalArgumentException.
scala> <x/> \ "@"
java.lang.IllegalArgumentException: @
scala> <x/> \@ ""
java.lang.IllegalArgumentException: @
There's no such thing as an empty attribute.
However, when the improper matching value is used against more than
just one element, no error is thrown, just an empty NodeSeq is
returned:
scala> <x><y/><z/></x>.child \ "@"
res1: scala.xml.NodeSeq = NodeSeq()
It should be a failure.
Similarly, the attribute search method, is similarly affected.
scala> <x><y/><z/></x>.child \@ ""
res1: scala.xml.NodeSeq = NodeSeq()
This was identified while writing ScalaCheck property tests.1 parent 5bb1af0 commit 9a0db27
File tree
2 files changed
+20
-0
lines changed2 files changed
+20
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
157 | 176 | | |
0 commit comments