factor/basis/xml/interpolate/interpolate-tests.factor

47 lines
1.0 KiB
Factor
Raw Normal View History

2009-01-19 23:25:15 -05:00
! Copyright (C) 2009 Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
2009-01-25 22:06:45 -05:00
USING: tools.test xml.interpolate multiline kernel assocs
sequences accessors xml.writer xml.interpolate.private
2009-01-26 00:52:25 -05:00
locals splitting ;
2009-01-19 23:25:15 -05:00
IN: xml.interpolate.tests
2009-01-25 22:06:45 -05:00
2009-01-26 00:52:25 -05:00
[ "a" "c" { "a" "c" f } ] [
"<?xml version='1.0'?><x><-a-><b val=<-c->/><-></x>"
2009-01-25 22:06:45 -05:00
interpolated-doc
[ second var>> ]
[ fourth "val" swap at var>> ]
[ extract-variables ] tri
] unit-test
[ {" <?xml version="1.0" encoding="UTF-8"?>
<x>
one
<b val="two"/>
y
<foo/>
</x>"} ] [
[let* | a [ "one" ] c [ "two" ] x [ "y" ]
d [ [XML <-x-> <foo/> XML] ] |
<XML
<x> <-a-> <b val=<-c->/> <-d-> </x>
XML> pprint-xml>string
]
] unit-test
2009-01-26 00:52:25 -05:00
[ {" <?xml version="1.0" encoding="UTF-8"?>
<doc>
<item>
one
</item>
<item>
two
</item>
<item>
three
</item>
</doc>"} ] [
"one two three" " " split
[ [XML <item><-></item> XML] ] map
<XML <doc><-></doc> XML> pprint-xml>string
] unit-test