Commit 63e713fd authored by ijones's avatar ijones
Browse files

modified certain tests to not be IO [Test] since that's implicit

parent 32edf8f3
......@@ -50,7 +50,7 @@ import qualified Distribution.Version as D.V (hunitTests)
-- import qualified Distribution.InstalledPackageInfo(hunitTests)
import qualified Distribution.Misc as D.M (hunitTests)
import qualified Distribution.Package as D.P (hunitTests)
import qualified Distribution.Setup (hunitTests)
import qualified Distribution.Setup as D.Setup (hunitTests)
import qualified Distribution.Simple as D.S (simpleHunitTests)
import qualified Distribution.Simple.Install as D.S.I (hunitTests)
......@@ -83,7 +83,7 @@ tests = [TestCase $
do setCurrentDirectory "test"
dirE1 <- doesDirectoryExist ",tmp"
when dirE1 (system "rm -r ,tmp">>return())
system "ls"
-- system "ls"
system "./setup configure --prefix=,tmp"
let targetDir = ",tmp/lib/test-1.0/"
system "./setup build"
......@@ -103,17 +103,14 @@ tests = [TestCase $
main :: IO ()
main = do putStrLn "compile successful"
putStrLn "-= Setup Tests =-"
setupTests <- Distribution.Setup.hunitTests
confTests <- D.S.C.hunitTests
utilTests <- D.S.U.hunitTests
mapM runTestTT' setupTests
mapM runTestTT' confTests
runTestTT' utilTests
runTestTT' $ TestList (D.S.R.hunitTests ++ D.V.hunitTests ++
D.S.S.hunitTests ++ D.S.B.hunitTests ++
D.S.I.hunitTests ++ D.S.simpleHunitTests ++
D.P.hunitTests ++ D.M.hunitTests)
runTestTT' $ TestList $
(TestLabel "Utils Tests" $ TestList D.S.U.hunitTests):
(TestLabel "Setup Tests" $ TestList D.Setup.hunitTests):
(TestLabel "config Tests" $ TestList D.S.C.hunitTests):
(D.S.R.hunitTests ++ D.V.hunitTests ++
D.S.S.hunitTests ++ D.S.B.hunitTests ++
D.S.I.hunitTests ++ D.S.simpleHunitTests ++
D.P.hunitTests ++ D.M.hunitTests)
runTestTT' $ TestList tests
return ()
......
......@@ -231,12 +231,12 @@ commands = [("configure", "configure this package"),
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: IO [Test]
hunitTests :: [Test]
hunitTests =
do let m = [("ghc", GHC), ("nhc", NHC), ("hugs", Hugs)]
let (flags, commands', unkFlags, ers)
let m = [("ghc", GHC), ("nhc", NHC), ("hugs", Hugs)]
(flags, commands', unkFlags, ers)
= getOpt Permute options ["configure", "foobar", "--prefix=/foo", "--ghc", "--nhc", "--hugs", "--with-compiler=/comp", "--unknown1", "--unknown2", "--install-prefix=/foo", "--user", "--global"]
return $ [TestLabel "very basic option parsing" $ TestList [
in [TestLabel "very basic option parsing" $ TestList [
"getOpt flags" ~: "failed" ~:
[Prefix "/foo", GhcFlag, NhcFlag, HugsFlag,
WithCompiler "/comp", InstPrefix "/foo", UserFlag, GlobalFlag]
......
......@@ -51,7 +51,7 @@ module Distribution.Simple.Configure (writePersistBuildConfig,
where
import Distribution.Setup(ConfigFlags,CompilerFlavor(..), Compiler(..))
import Distribution.Package(PackageDescription(..))
import Distribution.Package(PackageDescription(..), emptyPackageDescription)
import Distribution.Simple.Utils (die, setupMessage,
findBinary, splitFilenameDir)
import Distribution.Package ( PackageIdentifier )
......@@ -199,16 +199,17 @@ message s = putStrLn $ "configure: " ++ s
-- Tests
#ifdef DEBUG
hunitTests :: IO [Test]
hunitTests = do
let simonMarGHCLoc = "/home/simonmar/fp/bin/i386-unknown-linux/ghc"
simonMarGHC <- configure PackageDescription{} (Just GHC,
hunitTests :: [Test]
hunitTests
= [TestCase $
do let simonMarGHCLoc = "/home/simonmar/fp/bin/i386-unknown-linux/ghc"
simonMarGHC <- configure emptyPackageDescription (Just GHC,
Just simonMarGHCLoc,
Nothing)
return $ [TestLabel "Configure Testing" $ TestList [
"finding ghc, etc on simonMar's machine" ~: "failed" ~:
assertEqual "finding ghc, etc on simonMar's machine failed"
(LocalBuildInfo "/usr" (Compiler GHC
simonMarGHCLoc
(simonMarGHCLoc ++ "-pkg")) [])
~=? simonMarGHC]]
simonMarGHC
]
#endif
......@@ -70,7 +70,7 @@ import System.Cmd
import System.Environment
import System.Directory
import HUnit ((~:), (~=?), Test(..))
import HUnit ((~:), (~=?), Test(..), assertEqual)
-- -----------------------------------------------------------------------------
-- Pathname-related utils
......@@ -285,21 +285,19 @@ moveSources _targetDir sources mains
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: IO Test
hunitTests :: [Test]
hunitTests
= do mp1 <- moduleToFilePath "Distribution.Simple.Build" --exists
mp2 <- moduleToFilePath "Foo.Bar" -- doesn't exist
return $ TestLabel "Utils Tests" $ TestList
["moduleToPossiblePaths 1" ~: "failed" ~:
["Foo/Bar/Bang.hs","Foo/Bar/Bang.lhs"]
= [TestCase $
do mp1 <- moduleToFilePath "Distribution.Simple.Build" --exists
mp2 <- moduleToFilePath "Foo.Bar" -- doesn't exist
assertEqual "existing not found failed"
(Just "Distribution/Simple/Build.hs") mp1
assertEqual "not existing not nothing failed" Nothing mp2,
"moduleToPossiblePaths 1" ~: "failed" ~:
["Foo/Bar/Bang.hs","Foo/Bar/Bang.lhs"]
~=? (moduleToPossiblePaths "Foo.Bar.Bang"),
"moduleToPossiblePaths2 " ~: "failed" ~:
(moduleToPossiblePaths "Foo")
~=? ["Foo.hs", "Foo.lhs"],
"existing not found" ~: "failed" ~:
(Just "Distribution/Simple/Build.hs") ~=? mp1,
"not existing not nothing" ~: "failed" ~: Nothing ~=? mp2
]
"moduleToPossiblePaths2 " ~: "failed" ~:
(moduleToPossiblePaths "Foo") ~=? ["Foo.hs", "Foo.lhs"]
]
#endif
Supports Markdown
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