]> gitweb.factorcode.org Git - factor.git/blob - basis/syndication/syndication-tests.factor
scryfall: better moxfield words
[factor.git] / basis / syndication / syndication-tests.factor
1 USING: syndication io kernel io.files tools.test io.encodings.binary
2 calendar urls xml.writer ;
3 IN: syndication.tests
4
5 : load-news-file ( filename -- feed )
6     ! Load an news syndication file and process it, returning
7     ! it as an feed tuple.
8     binary file-contents parse-feed ;
9
10 { T{
11     feed
12     f
13     "Meerkat"
14     URL" http://meerkat.oreillynet.com"
15     {
16         T{
17             entry
18             f
19             "XML: A Disruptive Technology"
20             URL" http://c.moreover.com/click/here.pl?r123"
21             "\n      XML is placing increasingly heavy loads on the existing technical\n      infrastructure of the Internet.\n    "
22             f
23         }
24     }
25 } } [ "vocab:syndication/test/rss1.xml" load-news-file ] unit-test
26 { T{
27     feed
28     f
29     "dive into mark"
30     URL" http://example.org/"
31     {
32         T{
33             entry
34             f
35             "Atom draft-07 snapshot"
36             URL" http://example.org/2005/04/02/atom"
37             "\n         <div xmlns=\"http://www.w3.org/1999/xhtml\">\n           <p><i>[Update: The Atom draft is finished.]</i></p>\n         </div>\n       "
38
39             T{ timestamp f 2003 12 13 8 29 29 T{ duration f 0 0 0 -4 0 0 } }
40         }
41     }
42 } } [ "vocab:syndication/test/atom.xml" load-news-file ] unit-test
43 { t } [ "vocab:syndication/test/atom.xml" load-news-file dup feed>xml xml>feed = ] unit-test