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