X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FTSN%2FXml.hs;h=ddde728afa9c76727a427c849ee14a0d4a140100;hp=ead8015de509481f31ca9ec3b4e23ac89b0fadc5;hb=91f4cfbc5214ad3a6db8dba09001639b905cab02;hpb=93c998a40aa28b0aba023aaa040866ded7d87ae9 diff --git a/src/TSN/Xml.hs b/src/TSN/Xml.hs index ead8015..ddde728 100644 --- a/src/TSN/Xml.hs +++ b/src/TSN/Xml.hs @@ -3,11 +3,14 @@ -- 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 ( (>>>), (/>), @@ -35,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