X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXml.hs;h=4c1123f0c71f5aa4b20794031b262a862363ccc7;hb=eb1187607a616b36bb446650dc141019345eed8f;hp=ead8015de509481f31ca9ec3b4e23ac89b0fadc5;hpb=a2c2a1a6865be7b4cd17fb72de635bb9385728b9;p=dead%2Fhtsn.git diff --git a/src/TSN/Xml.hs b/src/TSN/Xml.hs index ead8015..4c1123f 100644 --- a/src/TSN/Xml.hs +++ b/src/TSN/Xml.hs @@ -3,11 +3,13 @@ -- 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 ( (>>>), (/>), @@ -32,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