aboutsummaryrefslogtreecommitdiff
path: root/html-test
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-05 17:30:10 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-22 23:40:26 +0200
commit503e92e8e0d452c9eef30171f76f8f425912beef (patch)
tree157519c124a7aba3ef156cb31ec1e6777ced05c3 /html-test
parent4ca12fff14afffc61d80ca0edd2106bd5d3d738e (diff)
Create stub methods for processing test output as XML documents.
Diffstat (limited to 'html-test')
-rwxr-xr-xhtml-test/run.hs20
1 files 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