factor/libs/xml/test.factor

31 lines
1.3 KiB
Factor
Raw Normal View History

2006-11-09 16:01:57 -05:00
! Copyright (C) 2005, 2006 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
IN: temporary
2006-11-28 21:57:29 -05:00
REQUIRES: libs/xml/example ;
2006-11-23 19:37:41 -05:00
USING: kernel xml test io namespaces hashtables sequences
errors parser xml-arith strings ;
2006-11-09 16:01:57 -05:00
! This is insufficient
SYMBOL: xml-file
2006-11-28 21:57:29 -05:00
[ ] [ "libs/xml/test.xml" resource-path <file-reader>
2006-11-26 21:48:21 -05:00
stream>xml xml-file set ] unit-test
2006-11-09 16:01:57 -05:00
[ "1.0" ] [ xml-file get xml-doc-prolog prolog-version ] unit-test
[ f ] [ xml-file get xml-doc-prolog prolog-standalone ] unit-test
[ "a" ] [ xml-file get name-space ] unit-test
[ "http://www.hello.com" ] [ xml-file get name-url ] unit-test
2006-11-23 19:37:41 -05:00
[ T{ xml-string f { "that" } } ]
[ T{ name f "" "this" "http://d.de" } xml-file get
2006-11-09 16:01:57 -05:00
tag-props hash ] unit-test
[ t ] [ xml-file get tag-children second contained-tag? ] unit-test
[ t ] [ [ "<a></b>" string>xml ] catch xml-parse-error? ] unit-test
2006-11-12 18:01:16 -05:00
[ "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"no\"?><a b=\"c\"/>" ]
2006-11-23 19:37:41 -05:00
[ "<a b='c'/>" xml-reprint ] unit-test
[ 32 ] [
"<math><times><add><number>1</number><number>3</number></add><neg><number>-8</number></neg></times></math>"
calc-arith
] unit-test
[ "abcd" ] [
"<main>a<sub>bc</sub>d<nothing/></main>" string>xml
[ [ dup string? [ % ] [ drop ] if ] xml-each ] "" make
] unit-test