]> gitweb.factorcode.org Git - factor.git/blob - basis/xml/traversal/traversal-tests.factor
43076a5a416e65301a1aba8c29049c3b789dc8e7
[factor.git] / basis / xml / traversal / traversal-tests.factor
1 ! Copyright (C) 2005, 2009 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: xml xml.traversal tools.test xml.data sequences arrays kernel ;
4 IN: xml.traversal.tests
5
6 [ "bar" ] [ "<foo>bar</foo>" string>xml children>string ] unit-test
7
8 [ "" ] [ "<foo></foo>" string>xml children>string ] unit-test
9
10 [ "" ] [ "<foo/>" string>xml children>string ] unit-test
11
12 [ "bar qux" ] [ "<foo>bar <baz>qux</baz></foo>" string>xml deep-children>string ] unit-test
13
14 [ "blah" ] [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tag-named "attr" attr ] unit-test
15
16 [ { "blah" } ] [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tags-named [ "attr" attr ] map ] unit-test
17
18 [ "blah" ] [ "<foo attr='blah'/>" string>xml "foo" deep-tag-named "attr" attr ] unit-test
19
20 [ { "blah" } ] [ "<foo attr='blah'/>" string>xml "foo" deep-tags-named [ "attr" attr ] map ] unit-test
21
22 [ { "blah" } ] [ "<foo><bar attr='blah'/></foo>" string>xml "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test
23 [ { "blah" } ] [ "bar" { { "attr" "blah" } } f <tag> 1array "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test
24
25 [ { "http://hub.example.com" "http://alt.example.com" } ] [ "<head><link rel='alternate' href='http://alt.example.com'/><link rel='hub' href='http://hub.example.com'/></head>" string>xml-chunk "head" tag-named [ "link" "hub" "rel" tag-named-with-attr ] [ "link" "alternate" "rel" tag-named-with-attr ] bi [ "href" attr ] bi@ 2array ] unit-test