X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXml.hs;h=ddde728afa9c76727a427c849ee14a0d4a140100;hb=91f4cfbc5214ad3a6db8dba09001639b905cab02;hp=1f057f9982cd9b299a1c97db2913ecc395e12118;hpb=d4d924b26e451aec9ad84b6d9d376ba2aeab3422;p=dead%2Fhtsn.git diff --git a/src/TSN/Xml.hs b/src/TSN/Xml.hs index 1f057f9..ddde728 100644 --- a/src/TSN/Xml.hs +++ b/src/TSN/Xml.hs @@ -1,10 +1,16 @@ +-- | Minimal XML functionality needed to parse each document's +-- XML_File_ID. +-- module TSN.Xml ( parse_xmlfid, - xml_prologue ) + 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 ( (>>>), (/>), @@ -32,3 +38,25 @@ parse_xmlfid = -- | 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