summaryrefslogtreecommitdiff
path: root/tests/feeds
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2009-03-22 21:28:56 +0000
committerDave Beckett <dave@dajobe.org>2009-03-22 21:28:56 +0000
commit59b9f3c9c93b44fca8493093df64ad1342ff1080 (patch)
tree2cfaf1974fb8ae8ab118f6980cfed1d379774040 /tests/feeds
parentc512fc1d8e00f06b22fd6db1565979bf472a25fb (diff)
downloadraptor-59b9f3c9c93b44fca8493093df64ad1342ff1080.tar.gz
Add parsing and serializing tests with intermediate turtle results to check
Diffstat (limited to 'tests/feeds')
-rw-r--r--tests/feeds/Makefile.am43
-rw-r--r--tests/feeds/test01-result.ttl40
-rw-r--r--tests/feeds/test02-result.ttl41
-rw-r--r--tests/feeds/test03-result.ttl57
4 files changed, 178 insertions, 3 deletions
diff --git a/tests/feeds/Makefile.am b/tests/feeds/Makefile.am
index 2425b5a2..c87af964 100644
--- a/tests/feeds/Makefile.am
+++ b/tests/feeds/Makefile.am
@@ -22,6 +22,8 @@
TEST_RSS=test01.rss test02.rss test03.rss
TEST_ATOMS=$(TEST_RSS:.rss=.atom)
+TEST_TTLS=$(TEST_RSS:.rss=.ttl)
+OUT_TTLS=$(TEST_RSS:.rss=-result.ttl)
OUT_ATOMS=$(TEST_RSS:.rss=-result.atom)
EXTRA_ATOMS=
@@ -61,15 +63,50 @@ check-local:: check-feeds
endif
+@RAPTOR_PARSER_RSS_TRUE@check-local:: check-parse-feed
@RAPTOR_SERIALIZER_ATOM_TRUE@check-local:: check-serialize-atom
check-feeds: build-rapper $(TEST_FILES)
-check-serialize-atom $(TEST_ATOMS): $(TEST_RSS)
+check-parse-feed $(TEST_TTLS): $(TEST_RSS)
@set +e; result=0; \
- echo "Testing Atom XML serializing"; \
+ echo "Testing Feed parsing"; \
for test in $(TEST_RSS); do \
name=`basename $$test .rss` ; \
+ turtle="$$name.ttl"; \
+ expected="$$name-result.ttl"; \
+ opts="-f writeBaseURI=0"; \
+ if test $$name = test01; then \
+ baseuri="http://example.org/whatsnew"; \
+ elif test $$name = test02; then \
+ baseuri="http://example.org/news/"; \
+ elif test $$name = test03; then \
+ baseuri="http://example.org"; \
+ fi; \
+ opts="-q -i rdfxml -o turtle $$opts -O $$baseuri"; \
+ echo $(ECHO_N) "Checking $$test $(ECHO_C)"; \
+ $(RAPPER) $$opts file:$(srcdir)/$$test > $$turtle 2> errors.log; \
+ status=$$?; \
+ if test $$status != 0; then \
+ echo "FAILED with code $$status"; \
+ echo "$(RAPPER) $$opts file:$(srcdir)/$$test"; \
+ cat errors.log ; \
+ elif cmp $(srcdir)/$$expected $$turtle >/dev/null 2>&1; then \
+ echo "ok"; \
+ else \
+ echo "FAILED"; \
+ echo "$(RAPPER) $$opts file:$(srcdir)/$$test"; \
+ diff -u $(srcdir)/$$expected $$turtle; result=1; \
+ fi; \
+ rm -f errors.log ; \
+ done; \
+ set -e; exit $$result
+
+check-serialize-atom $(TEST_ATOMS): $(TEST_TTLS)
+ @set +e; result=0; \
+ echo "Testing Atom XML serializing"; \
+ for test in $(TEST_TTLS); do \
+ name=`basename $$test .ttl` ; \
atom="$$name.atom"; \
expected="$$name-result.atom"; \
opts="-f writeBaseURI=0 -f rssTriples=atom-triples"; \
@@ -81,7 +118,7 @@ check-serialize-atom $(TEST_ATOMS): $(TEST_RSS)
elif test $$name = test03; then \
baseuri="http://example.org"; \
fi; \
- opts="-q -i rdfxml -o atom $$opts -O $$baseuri"; \
+ opts="-q -i turtle -o atom $$opts -O $$baseuri"; \
echo $(ECHO_N) "Checking $$test $(ECHO_C)"; \
$(RAPPER) $$opts file:$(srcdir)/$$test > $$atom 2> errors.log; \
status=$$?; \
diff --git a/tests/feeds/test01-result.ttl b/tests/feeds/test01-result.ttl
new file mode 100644
index 00000000..ed59c939
--- /dev/null
+++ b/tests/feeds/test01-result.ttl
@@ -0,0 +1,40 @@
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix atom: <http://www.w3.org/2005/Atom> .
+@prefix content: <http://purl.org/rss/1.0/modules/content/> .
+@prefix dc: <http://purl.org/dc/elements/1.1/> .
+@prefix enc: <http://purl.oclc.org/net/rss_2.0/enc#> .
+@prefix rss091: <http://purl.org/rss/1.0/modules/rss091#> .
+@prefix : <http://purl.org/rss/1.0/> .
+
+<>
+ dc:date "2006-03-28T17:05:01-05:00" ;
+ :items [
+ rdf:_1 <2006/03/28/blog-item> ;
+ a rdf:Seq
+ ] ;
+ :link "http://example.org/whatsnew" ;
+ :title "example feed with 1 item" ;
+ a :channel ;
+ atom:author "example" ;
+ atom:email "example@example.com" ;
+ atom:title "atomic title" ;
+ atom:updated "2006-03-28T20:57:15Z" ;
+ atom:uri "http://example.com/" .
+
+<2006/03/28/blog-item>
+ dc:creator [
+ dc:title "Example" ;
+ a dc:Person
+ ] ;
+ dc:date "2006-03-28T20:57:15Z" ;
+ :description "rss:description here" ;
+ :link "http://example.org/2006/03/28/blog-item" ;
+ :title "Original blog item title 2006-03" ;
+ a :item ;
+ atom:summary """<div xmlns=\"http://www.w3.org/1999/xhtml\">The atom:summary description including
+<b>tags</b>
+over several lines.
+</div>"""^^rdf:XMLLiteral ;
+ atom:title "atomic blog item title" ;
+ atom:updated "2006-03-28T20:57:15Z" .
+
diff --git a/tests/feeds/test02-result.ttl b/tests/feeds/test02-result.ttl
new file mode 100644
index 00000000..97548269
--- /dev/null
+++ b/tests/feeds/test02-result.ttl
@@ -0,0 +1,41 @@
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix content: <http://purl.org/rss/1.0/modules/content/> .
+@prefix dc: <http://purl.org/dc/elements/1.1/> .
+@prefix : <http://purl.org/rss/1.0/> .
+
+<>
+ dc:date "2008-03-30T05:52:06Z" ;
+ :description "Example News feed." ;
+ :items [
+ rdf:_1 <2008-03-30> ;
+ rdf:_2 <2007-10-01> ;
+ a rdf:Seq
+ ] ;
+ :link "http://example.org/news/" ;
+ :title "Example News" ;
+ a :channel .
+
+<2008-03-30>
+ dc:date "2008-03-30T06:07:28Z" ;
+ :description """<div xmlns=\"http://www.w3.org/1999/xhtml\"><ul>
+html description 2
+</div>""" ;
+ :link "http://example.org/news/2008-03-30" ;
+ content:encoded """<div xmlns=\"http://www.w3.org/1999/xhtml\">
+html description 1
+</div>""" ;
+ :title "News for 2008-03-30" ;
+ a :item .
+
+<2007-10-01>
+ dc:date "2007-10-01T06:56:58Z" ;
+ :description """<div xmlns=\"http://www.w3.org/1999/xhtml\"><ul>
+html description 4
+</div>""" ;
+ :link "http://example.org/news/2007-10-01" ;
+ content:encoded """<div xmlns=\"http://www.w3.org/1999/xhtml\">
+html description 3
+</div>""" ;
+ :title "News for 2007-10-01" ;
+ a :item .
+
diff --git a/tests/feeds/test03-result.ttl b/tests/feeds/test03-result.ttl
new file mode 100644
index 00000000..80704b8f
--- /dev/null
+++ b/tests/feeds/test03-result.ttl
@@ -0,0 +1,57 @@
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix atom: <http://www.w3.org/2005/Atom> .
+@prefix content: <http://purl.org/rss/1.0/modules/content/> .
+@prefix dc: <http://purl.org/dc/elements/1.1/> .
+@prefix at: <http://purl.org/syndication/atomtriples/1> .
+@prefix : <http://purl.org/rss/1.0/> .
+
+</whatsnew>
+ dc:date "2006-03-28T17:05:01-05:00" ;
+ :items [
+ rdf:_1 </2006/03/03/blog-item> ;
+ rdf:_2 </2006/02/02/blog-item> ;
+ rdf:_3 </2006/01/01/blog-item> ;
+ rdf:_4 </2005/12/12/blog-item> ;
+ a rdf:Seq
+ ] ;
+ :title "example feed with 3 items" ;
+ a :channel ;
+ atom:author "bob" ;
+ atom:email "bob@bob.com" ;
+ atom:updated "2006-03-28T20:57:15Z" ;
+ atom:uri "http://bob.com/" .
+
+</2006/03/03/blog-item>
+ dc:date "2006-03-03T12:00:005Z" ;
+ :description "the summary of the item" ;
+ :title "blog item title 2006-02" ;
+ a :item ;
+ atom:content """<div xmlns=\"http://www.w3.org/1999/xhtml\">a literal XML atom:content with
+<b>tags</b> and
+newlines</div>"""^^rdf:XMLLiteral ;
+ atom:updated "2006-03-03T23:59:59Z" .
+
+</2006/02/02/blog-item>
+ dc:date "2006-02-02T00:00:02Z" ;
+ content:encoded """<div xmlns=\"http://www.w3.org/1999/xhtml\">a content:encoded description with
+<b xmlns=\"http://www.w3.org/1999/xhtml\">tags</b> and
+newlines</div>""" ;
+ :title "blog item title 2006-02" ;
+ a :item .
+
+</2006/01/01/blog-item>
+ dc:date "2006-01-01T00:00:01Z" ;
+ :title "blog item title 2006-01" ;
+ a :item ;
+ atom:summary """<div xmlns=\"http://www.w3.org/1999/xhtml\">The atom:summary description including
+<b>tags</b>
+over several lines.</div>"""^^rdf:XMLLiteral .
+
+</2005/12/12/blog-item>
+ dc:date "2005-12-12T00:00:00Z" ;
+ :description "the rss description" ;
+ :title "blog item title 2005-12" ;
+ at:contentType "text/html" ;
+ a :item ;
+ atom:content <http://external.example.org/> .
+