aboutsummaryrefslogtreecommitdiff
path: root/html-test/run.hs
diff options
context:
space:
mode:
Diffstat (limited to 'html-test/run.hs')
-rwxr-xr-xhtml-test/run.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/html-test/run.hs b/html-test/run.hs
index 71d78f73..99ca1ec1 100755
--- a/html-test/run.hs
+++ b/html-test/run.hs
@@ -2,6 +2,7 @@
{-# LANGUAGE CPP #-}
+import System.Directory
import System.Environment
import System.FilePath
@@ -18,11 +19,20 @@ outDir = baseDir </> "out"
main :: IO ()
main = do
- files <- map processArg <$> getArgs
+ files <- processArgs =<< getArgs
putStrLn $ "Files to test: " ++ show files
+processArgs :: [String] -> IO [FilePath]
+processArgs [] = filter isSourceFile <$> getDirectoryContents srcDir
+processArgs args = pure $ map processArg args
+
+
processArg :: String -> FilePath
processArg arg
- | takeExtension arg `elem` [".hs", ".lhs"] = arg
+ | isSourceFile arg = arg
| otherwise = srcDir </> arg <.> "hs"
+
+
+isSourceFile :: FilePath -> Bool
+isSourceFile path = takeExtension path `elem` [".hs", ".lhs"]