From 503e92e8e0d452c9eef30171f76f8f425912beef Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Wed, 5 Aug 2015 17:30:10 +0200 Subject: Create stub methods for processing test output as XML documents. --- html-test/run.hs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/html-test/run.hs b/html-test/run.hs index ee2d0829..87d53bab 100755 --- a/html-test/run.hs +++ b/html-test/run.hs @@ -1,6 +1,7 @@ #!/usr/bin/env runhaskell {-# LANGUAGE CPP #-} {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE StandaloneDeriving #-} import Control.Applicative @@ -26,6 +27,8 @@ import System.FilePath import System.IO import System.Process +import qualified Text.XML.Light as Xml + baseDir, rootDir :: FilePath baseDir = takeDirectory __FILE__ @@ -157,12 +160,14 @@ checkModule mdl = do hasRef <- doesFileExist $ refFile mdl if hasRef then do - out <- readFile $ outFile mdl - ref <- readFile $ refFile mdl - return $ if haddockEq (outFile mdl, out) (refFile mdl, ref) + Just outXml <- readXml $ outFile mdl + Just refXml <- readXml $ refFile mdl + return $ if strip outXml == strip refXml then Pass else Fail else return NoRef + where + readXml = liftM Xml.parseXMLDoc . readFile diffModule :: FilePath -> String -> IO () @@ -253,6 +258,15 @@ modulePath :: String -> FilePath modulePath mdl = srcDir mdl <.> "hs" +deriving instance Eq Xml.Content +deriving instance Eq Xml.Element +deriving instance Eq Xml.CData + + +strip :: Xml.Element -> Xml.Element +strip = id -- TODO. + + data Flag = FlagHaddockPath FilePath | FlagGhcPath FilePath -- cgit v1.2.3