Permalink
Browse files

Allow test runner to run only some tests specified on the command line

  • Loading branch information...
1 parent ad87420 commit 58a351cdcc61ba4564f7bcd92de699426bc62e25 @batterseapower committed Mar 5, 2011
Showing with 10 additions and 7 deletions.
  1. +10 −7 tests/Test.lhs
View
@@ -110,14 +110,17 @@ mtimeSanityCheck = flip Exception.finally (removeFileIfExists "delete-me") $ do
True `assertEqualM` (mtime1 /= mtime2 && mtime2 /= mtime3 && mtime1 /= mtime3)
-withTest :: FilePath -> [FilePath] -> IO a -> IO a
+withTest :: FilePath -> [FilePath] -> IO () -> IO ()
withTest dir clean_fps act = do
- putStr $ dir ++ ": "
- res <- withCurrentDirectory dir $ do
- clean (".openshake-db":clean_fps)
- act
- putStrLn "[OK]"
- return res
+ want_tests <- getArgs
+ let should_run_test = null want_tests || dir `elem` want_tests
+
+ when should_run_test $ do
+ putStr $ dir ++ ": "
+ withCurrentDirectory dir $ do
+ clean (".openshake-db":clean_fps)
+ act
+ putStrLn "[OK]"
main :: IO ()
main = do

0 comments on commit 58a351c

Please sign in to comment.