aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Conway <john.a.conway@gmail.com>2019-05-08 15:57:35 +0100
committerJohn Conway <john.a.conway@gmail.com>2019-05-08 15:57:35 +0100
commit01d296acb19c2f00d1868c2c74c2a3fd3a80fb53 (patch)
tree5b5727c8cda49d9375b543f444c7290fbaf589bb /tests
parent1aed195f821ed1f087ff46e00e6b3b4320e0bdb9 (diff)
downloadfeed-nim-01d296acb19c2f00d1868c2c74c2a3fd3a80fb53.tar.gz
feed-nim-01d296acb19c2f00d1868c2c74c2a3fd3a80fb53.zip
[Atom] Writing tests, fixing bugs
Diffstat (limited to 'tests')
-rw-r--r--tests/__test1.nim (renamed from tests/test1.nim)2
-rwxr-xr-xtests/test_atombin0 -> 409560 bytes
-rw-r--r--tests/test_atom.nim15
-rw-r--r--tests/test_atom.xml74
4 files changed, 52 insertions, 39 deletions
diff --git a/tests/test1.nim b/tests/__test1.nim
index 0ff07eb..185df0e 100644
--- a/tests/test1.nim
+++ b/tests/__test1.nim
@@ -7,6 +7,6 @@
import unittest
-import FeedNim
+import feednim
test "can add":
check add(5, 5) == 10
diff --git a/tests/test_atom b/tests/test_atom
new file mode 100755
index 0000000..991e0e6
--- /dev/null
+++ b/tests/test_atom
Binary files differ
diff --git a/tests/test_atom.nim b/tests/test_atom.nim
index 3d563da..c4c65f9 100644
--- a/tests/test_atom.nim
+++ b/tests/test_atom.nim
@@ -5,12 +5,19 @@
#
# To run these tests, simply execute `nimble test`.
+import unittest
+import marshal
+import feednim
+test "Read Valid Atom Feed":
+ let feed = "./tests/test_atom.xml".loadAtom()
-import unittest
+ echo $$feed
-import FeedNim
-test "can add":
- check add(5, 5) == 10
+ check feed.title != ""
+ check feed.generator != ""
+ check feed.authors[0].name == "Joe Bloggs"
+ check feed.authors[0].uri == "http://joe.bloggs"
+ check feed.authors[0].email == "mail@joe.bloggs" \ No newline at end of file
diff --git a/tests/test_atom.xml b/tests/test_atom.xml
index 64f443d..5ea44a2 100644
--- a/tests/test_atom.xml
+++ b/tests/test_atom.xml
@@ -3,30 +3,37 @@
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
<title>Bloggs's Planes Trains and Automobiles</title>
<updated>2003-12-13T18:30:02Z</updated>
+
<author>
<name>Joe Bloggs</name>
<uri>http://joe.bloggs</uri>
<email>mail@joe.bloggs</email>
</author>
+
<contributor>
<name>Jane Bloggs</name>
</contributor>
- <category>Planes</category>
- <category>Trains</category>
- <category>Automobiles</category>
- <generator>nim<generator>
+
+ <category term="planes" label="Planes" scheme="http://awesomecategories.org"/>
+ <category term="trains" label="Trains" />
+ <category term="automobiles" label="Automobiles" />
+
+ <generator uri="https://github.com/dom96/jester">Jester</generator>
+
<icon>http://joe.bloggs/mug,jpg</icon>
+
<link
- href="http://joe.bloggs/american"
- rel="alternate"
- type="application/xml+rss"
- hreflang="en-US"
- title="Ye-ha"
+ href="http://joe.bloggs/atom"
+ rel="self"
+ type="application/xml+atom"
+ hreflang="en-GB"
+ title="Bloggs's Planes Trains and Automobiles"
length="1000000"
/>
- <logo>&copy; Joe and Jane Bloggs</logo>
- <rights>&copy; Joe and Jane Bloggs</rights>
- <subtitle></subtitle>
+
+ <logo>http://joe.bloggs/logo.jpeg</logo>
+ <rights>Copyright Joe and Jane Bloggs</rights>
+ <subtitle>About Trains, Planes, and Autonmobiles.</subtitle>
<entry>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
@@ -34,38 +41,29 @@
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>Joe Bloggs</name>
- <url>http://joe.bloggs</url>
+ <uri>http://joe.bloggs</uri>
<email>mail@joe.bloggs</email>
</author>
- <category>planes</category>
- <content type="html">
- <b>Aero</b>- not air-, fools!
+ <category term="words" label="Words" scheme="http://awesomecategories.org" />
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <p><i>Aero</i>- not air-, fools!</p>
+ </div>
</content>
- <link
- href="http://planes.com"
- rel="reply"
- type="html"
- hreflang="en-US"
- title="Airplanes not Aeroplanes"
- length="1000000"
- />
<published>2003-12-13T18:30:02Z</published>
- <rights>&copy; Joe Bloggs</rights>
+ <rights>Copyright Joe Bloggs</rights>
<source>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6d</id>
<title>Aeroplane</title>
<subtitle>Aeroplanes</subtitle>
<updated>1755-04-15T18:30:00Z</updated>
<author>
<name>Samuel Johnson</name>
- <url>http://dictionary.com</url>
+ <uri>http://dictionary.com</uri>
<email>sjohnson@dictionary.com</email>
</author>
- <category>words</category>
- <rights>&copy; Samual Johnson</rights>
-
-
-
+ <category term="planes" label="Planes" scheme="http://awesomecategories.org" />
+ <rights>Copyright Samual Johnson</rights>
</source>
</entry>
@@ -76,10 +74,18 @@
<author>
<name>Jane Bloggs</name>
</author>
- <category>trains</category>
+ <category term="trains" label="Trains" />
<content src="http://trains.com"></content>
+ <link
+ href="http://joe.bloggs/trains-full"
+ rel="alternate"
+ type="text/html"
+ hreflang="en-GB"
+ title="Trains!"
+ length="1000000"
+ />
<published>2003-12-13T18:20:02Z</published>
- <rights>&copy; Jane Bloggs</rights>
+ <rights>Copyright Jane Bloggs</rights>
<summary>
Trains!
</summary>