X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FTSN%2FXml.hs;h=4c1123f0c71f5aa4b20794031b262a862363ccc7;hp=1f057f9982cd9b299a1c97db2913ecc395e12118;hb=eb1187607a616b36bb446650dc141019345eed8f;hpb=d4d924b26e451aec9ad84b6d9d376ba2aeab3422 diff --git a/src/TSN/Xml.hs b/src/TSN/Xml.hs index 1f057f9..4c1123f 100644 --- a/src/TSN/Xml.hs +++ b/src/TSN/Xml.hs @@ -1,10 +1,15 @@ +-- | Minimal XML functionality needed to parse each document's +-- XML_File_ID. +-- module TSN.Xml ( parse_xmlfid, - xml_prologue ) + xml_tests ) where -import Data.Maybe (listToMaybe, mapMaybe) -import Text.Read (readMaybe) +import Data.Maybe ( listToMaybe, mapMaybe ) +import Test.Tasty ( TestTree, testGroup ) +import Test.Tasty.HUnit ( (@?=), Assertion, testCase ) +import Text.Read ( readMaybe ) import Text.XML.HXT.Core ( (>>>), (/>), @@ -29,6 +34,24 @@ parse_xmlfid = >>> getText) --- | The opening "tag" for the XML prologue. -xml_prologue :: String -xml_prologue = " Assertion + check xmlfid = do + xml <- readFile ("test/xml/" ++ xmlfid ++ ".xml") + let actual = parse_xmlfid xml + let expected = readMaybe xmlfid + actual @?= expected