From 01d296acb19c2f00d1868c2c74c2a3fd3a80fb53 Mon Sep 17 00:00:00 2001 From: John Conway Date: Wed, 8 May 2019 15:57:35 +0100 Subject: [Atom] Writing tests, fixing bugs --- tests/__test1.nim | 12 +++++++++ tests/test1.nim | 12 --------- tests/test_atom | Bin 0 -> 409560 bytes tests/test_atom.nim | 15 ++++++++--- tests/test_atom.xml | 74 ++++++++++++++++++++++++++++------------------------ 5 files changed, 63 insertions(+), 50 deletions(-) create mode 100644 tests/__test1.nim delete mode 100644 tests/test1.nim create mode 100755 tests/test_atom (limited to 'tests') diff --git a/tests/__test1.nim b/tests/__test1.nim new file mode 100644 index 0000000..185df0e --- /dev/null +++ b/tests/__test1.nim @@ -0,0 +1,12 @@ +# This is just an example to get you started. You may wish to put all of your +# tests into a single file, or separate them into multiple `test1`, `test2` +# etc. files (better names are recommended, just make sure the name starts with +# the letter 't'). +# +# To run these tests, simply execute `nimble test`. + +import unittest + +import feednim +test "can add": + check add(5, 5) == 10 diff --git a/tests/test1.nim b/tests/test1.nim deleted file mode 100644 index 0ff07eb..0000000 --- a/tests/test1.nim +++ /dev/null @@ -1,12 +0,0 @@ -# This is just an example to get you started. You may wish to put all of your -# tests into a single file, or separate them into multiple `test1`, `test2` -# etc. files (better names are recommended, just make sure the name starts with -# the letter 't'). -# -# To run these tests, simply execute `nimble test`. - -import unittest - -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 Binary files /dev/null and b/tests/test_atom 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 @@ urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 Bloggs's Planes Trains and Automobiles 2003-12-13T18:30:02Z + Joe Bloggs http://joe.bloggs mail@joe.bloggs + Jane Bloggs - Planes - Trains - Automobiles - nim + + + + + + Jester + http://joe.bloggs/mug,jpg + - © Joe and Jane Bloggs - © Joe and Jane Bloggs - + + http://joe.bloggs/logo.jpeg + Copyright Joe and Jane Bloggs + About Trains, Planes, and Autonmobiles. urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a @@ -34,38 +41,29 @@ 2003-12-13T18:30:02Z Joe Bloggs - http://joe.bloggs + http://joe.bloggs mail@joe.bloggs - planes - - Aero- not air-, fools! + + +
+

Aero- not air-, fools!

+
- 2003-12-13T18:30:02Z - © Joe Bloggs + Copyright Joe Bloggs - urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a + urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6d Aeroplane Aeroplanes 1755-04-15T18:30:00Z Samuel Johnson - http://dictionary.com + http://dictionary.com sjohnson@dictionary.com - words - © Samual Johnson - - - + + Copyright Samual Johnson
@@ -76,10 +74,18 @@ Jane Bloggs - trains + + 2003-12-13T18:20:02Z - © Jane Bloggs + Copyright Jane Bloggs Trains! -- cgit v1.2.3