xml.traversal: tags-with-attr fix

release
Jeremy Hughes 2010-09-14 13:14:46 +12:00
parent e68602287c
commit 3806f02111
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
! Copyright (C) 2005, 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: xml xml.traversal tools.test xml.data sequences ;
USING: xml xml.traversal tools.test xml.data sequences arrays ;
IN: xml.traversal.tests
[ "bar" ] [ "<foo>bar</foo>" string>xml children>string ] unit-test
@ -16,3 +16,6 @@ IN: xml.traversal.tests
[ "blah" ] [ "<foo attr='blah'/>" string>xml "foo" deep-tag-named "attr" attr ] unit-test
[ { "blah" } ] [ "<foo attr='blah'/>" string>xml "foo" deep-tags-named [ "attr" attr ] map ] unit-test
[ { "blah" } ] [ "<foo><bar attr='blah'/></foo>" string>xml "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test
[ { "blah" } ] [ "bar" { { "attr" "blah" } } f <tag> 1array "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test

View File

@ -50,7 +50,7 @@ PRIVATE>
assure-name '[ _ _ tag-with-attr? ] find nip ;
: tags-with-attr ( tag attr-value attr-name -- tags-seq )
assure-name '[ _ _ tag-with-attr? ] filter children>> ;
assure-name '[ _ _ tag-with-attr? ] { } filter-as ;
: deep-tag-with-attr ( tag attr-value attr-name -- matching-tag )
assure-name '[ _ _ tag-with-attr? ] deep-find ;