Commit 772f2981 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Remove utils testing code for functions that are being removed

parent af3362ec
......@@ -79,9 +79,6 @@ module Distribution.Simple.Utils (
exeExtension,
objExtension,
dllExtension,
#ifdef DEBUG
hunitTests
#endif
) where
import Control.Monad
......@@ -130,10 +127,6 @@ import System.IO (Handle, hClose)
import Distribution.Compat.TempFile (openTempFile)
import Distribution.Verbosity
#ifdef DEBUG
import Test.HUnit ((~:), (~=?), Test(..), assertEqual)
#endif
-- ------------------------------------------------------------------------------- Utils for setup
dieWithLocation :: FilePath -> (Maybe Int) -> String -> IO a
......@@ -609,41 +602,3 @@ dllExtension = case os of
Windows _ -> "dll"
OSX -> "dylib"
_ -> "so"
-- ------------------------------------------------------------
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: [Test]
hunitTests
= let suffixes = ["hs", "lhs"]
in [TestCase $
do mp1 <- moduleToFilePath [""] "Distribution.Simple.Build" suffixes --exists
mp2 <- moduleToFilePath [""] "Foo.Bar" suffixes -- doesn't exist
assertEqual "existing not found failed"
["Distribution" </> "Simple" </> "Build.hs"] mp1
assertEqual "not existing not nothing failed" [] mp2,
"moduleToPossiblePaths 1" ~: "failed" ~:
["Foo" </> "Bar" </> "Bang.hs","Foo" </> "Bar" </> "Bang.lhs"]
~=? (moduleToPossiblePaths "" "Foo.Bar.Bang" suffixes),
"moduleToPossiblePaths2 " ~: "failed" ~:
(moduleToPossiblePaths "" "Foo" suffixes) ~=? ["Foo.hs", "Foo.lhs"],
TestCase (do files <- filesWithExtensions "." "cabal"
assertEqual "filesWithExtensions" "Cabal.cabal" (head files))
]
-- |Might want to make this more generic some day, with regexps
-- or something.
filesWithExtensions :: FilePath -- ^Directory to look in
-> String -- ^The extension
-> IO [FilePath] {- ^The file names (not full
path) of all the files with this
extension in this directory. -}
filesWithExtensions dir extension
= do allFiles <- getDirectoryContents dir
return $ filter hasExt allFiles
where
hasExt f = takeExtension f == '.':extension
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment