Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added some much needed specs for element selectors

  • Loading branch information...
commit 07a7de9e2836d24b1a14b6a7817a476f3e864133 1 parent dd3f451
@djspiewak authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/test/scala/com/codecommit/antixml/SelectorSpecs.scala
View
14 src/test/scala/com/codecommit/antixml/SelectorSpecs.scala
@@ -3,7 +3,7 @@ package com.codecommit.antixml
import org.specs._
object SelectorSpecs extends Specification {
- "the * selector should" in {
+ "the * selector" should {
"select nothing when parent is empty" in {
XML.fromString("<parent/>") \ * mustEqual Group()
}
@@ -14,4 +14,16 @@ object SelectorSpecs extends Specification {
xml \ * mustEqual expected
}
}
+
+ "the element selector(s)" should {
+ "select nothing when parent is empty" in {
+ (<parent/>).anti \ "parent" mustEqual Group()
+ (<parent/>).anti \ 'parent mustEqual Group()
+ }
+
+ "select only the named element(s)" in {
+ (<parent><foo/><bar/>Baz<foo/></parent>).anti \ "foo" mustEqual Group(<foo/>.anti, <foo/>.anti)
+ (<parent><foo/><bar/>Baz<foo/></parent>).anti \ 'foo mustEqual Group(<foo/>.anti, <foo/>.anti)
+ }
+ }
}

0 comments on commit 07a7de9

Please sign in to comment.
Something went wrong with that request. Please try again.