Merge branch 'master' of git://factorforge.org/git/littledan

db4
Slava Pestov 2008-08-28 22:20:51 -05:00
commit a1a8a39c34
2 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
USING: kernel xml sequences assocs tools.test io arrays namespaces
xml.data xml.utilities xml.writer generic sequences.deep ;
accessors xml.data xml.utilities xml.writer generic sequences.deep ;
IN: xml.tests
: sub-tag
@ -11,7 +11,7 @@ GENERIC: (r-ref) ( xml -- )
M: tag (r-ref)
sub-tag over at* [
ref-table get at
swap set-tag-children
>>children drop
] [ 2drop ] if ;
M: object (r-ref) drop ;
@ -34,7 +34,7 @@ M: object (r-ref) drop ;
[
H{
{ "foo" { "foo" } }
{ "bar" { "blah" T{ tag T{ name f "" "a" "" } V{ } f } } }
{ "bar" { "blah" T{ tag f T{ name f "" "a" "" } f f } } }
{ "baz" f }
} ref-table set
sample-doc string>xml dup template xml>string

View File

@ -3,7 +3,7 @@
IN: xml.tests
USING: kernel xml tools.test io namespaces sequences xml.errors xml.entities
parser strings xml.data io.files xml.writer xml.utilities state-parser
continuations assocs sequences.deep ;
continuations assocs sequences.deep accessors ;
! This is insufficient
\ read-xml must-infer
@ -11,22 +11,22 @@ USING: kernel xml tools.test io namespaces sequences xml.errors xml.entities
SYMBOL: xml-file
[ ] [ "resource:basis/xml/tests/test.xml"
[ file>xml ] with-html-entities xml-file set ] unit-test
[ "1.0" ] [ xml-file get xml-prolog prolog-version ] unit-test
[ f ] [ xml-file get xml-prolog prolog-standalone ] unit-test
[ "a" ] [ xml-file get name-space ] unit-test
[ "http://www.hello.com" ] [ xml-file get name-url ] unit-test
[ "1.0" ] [ xml-file get prolog>> version>> ] unit-test
[ f ] [ xml-file get prolog>> standalone>> ] unit-test
[ "a" ] [ xml-file get space>> ] unit-test
[ "http://www.hello.com" ] [ xml-file get url>> ] unit-test
[ "that" ] [
xml-file get T{ name f "" "this" "http://d.de" } swap at
] unit-test
[ t ] [ xml-file get tag-children second contained-tag? ] unit-test
[ t ] [ xml-file get children>> second contained-tag? ] unit-test
[ "<a></b>" string>xml ] [ xml-parse-error? ] must-fail-with
[ T{ comment f "This is where the fun begins!" } ] [
xml-file get xml-before [ comment? ] find nip
] unit-test
[ "xsl stylesheet=\"that-one.xsl\"" ] [
xml-file get xml-after [ instruction? ] find nip instruction-text
xml-file get after>> [ instruction? ] find nip text>>
] unit-test
[ V{ "fa&g" } ] [ xml-file get "x" get-id tag-children ] unit-test
[ V{ "fa&g" } ] [ xml-file get "x" get-id children>> ] unit-test
[ "that" ] [ xml-file get "this" swap at ] unit-test
[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a b=\"c\"/>" ]
[ "<a b='c'/>" string>xml xml>string ] unit-test