X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FXml.hs;h=1502d1c1e978b737607895349f991ec3cb29581d;hp=7f82a7d7ccff7f6b19595c7ccc84f3d05c8f21dd;hb=60aea8c7765bf2382b1d24d039f3951e00434e3c;hpb=4833dc57c60f4aeaa160ec5e599507653a47809b diff --git a/src/Xml.hs b/src/Xml.hs index 7f82a7d..1502d1c 100644 --- a/src/Xml.hs +++ b/src/Xml.hs @@ -3,6 +3,7 @@ -- module Xml ( parse_xmlfid, + -- * Tests xml_tests ) where @@ -20,10 +21,10 @@ import Text.XML.HXT.Core ( xreadDoc ) --- | A tiny parser written in HXT to extract the "XML_File_ID" element --- from a document. If we fail to parse an XML_File_ID, we return --- the reason wrapped in a 'Left' constructor. The reason should be --- one of two things: +-- | A tiny parser written in HXT to extract the \"XML_File_ID\" +-- element from a document. If we fail to parse an XML_File_ID, we +-- return the reason wrapped in a 'Left' constructor. The reason +-- should be one of two things: -- -- 1. No XML_File_ID elements were found. -- @@ -32,12 +33,12 @@ import Text.XML.HXT.Core ( -- -- We use an Either rather than a Maybe because we do expect some -- non-integer XML_File_IDs. In the examples, you will see --- NHL_DepthChart_XML.XML with an XML_File_ID of "49618.61" and --- CFL_Boxscore_XML1.xml with an XML_File_ID of "R28916". According --- to Brijesh Patel of TSN, these are special category files and not --- part of the usual feed. +-- NHL_DepthChart_XML.XML with an XML_File_ID of \"49618.61\" and +-- CFL_Boxscore_XML1.xml with an XML_File_ID of +-- \"R28916\". According to Brijesh Patel of TSN, these are special +-- category files and not part of the usual feed. -- --- We want to report them differently, "just in case." +-- We want to report them differently, \"just in case.\" -- parse_xmlfid :: String -- ^ The XML Document -> Either String Integer @@ -64,7 +65,12 @@ parse_xmlfid doc = parse_results = map read_either_integer elements --- * Tasty Tests +-- +-- Tasty Tests +-- + +-- | A list of all tests for this module. +-- xml_tests :: TestTree xml_tests = testGroup @@ -72,6 +78,9 @@ xml_tests = [ xml_file_id_tests ] +-- | Ensure that we parse the correct XML_File_ID out of some known +-- examples. +-- xml_file_id_tests :: TestTree xml_file_id_tests = testCase "XML_File_ID is parsed correctly" $ do