Commit 6f4fb435 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Remove more {-# OPTIONS -cpp #-} where it was only used for empty hunit tests

parent 8c8806ee
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple
......@@ -64,9 +63,6 @@ module Distribution.Simple (
defaultUserHooks, emptyUserHooks,
-- ** Utils
defaultHookedPackageDesc
#ifdef DEBUG
,simpleHunitTests
#endif
) where
-- local
......@@ -104,26 +100,19 @@ import Distribution.Simple.Utils
rawSystemPathExit, rawSystemExit)
import Distribution.Verbosity
import Language.Haskell.Extension
import Distribution.Version
import Distribution.License
-- Base
import System.Environment(getArgs,getProgName)
import System.Directory(removeFile, doesFileExist,
doesDirectoryExist, removeDirectoryRecursive)
import System.FilePath((</>))
import System.Exit
import Distribution.License
import Control.Monad (when, unless)
import Data.List (intersperse, unionBy)
import System.FilePath((</>))
#ifdef DEBUG
import Test.HUnit (Test)
import Distribution.Version hiding (hunitTests)
#else
import Distribution.Version
#endif
import System.Exit
-- | A simple implementation of @main@ for a Cabal setup script.
-- It reads the package description file using IO, and performs the
-- action specified on the command line.
......@@ -555,11 +544,3 @@ defaultRegHook pkg_descr localbuildinfo _ flags =
else setupMessage verbosity
"Package contains no library to register:" pkg_descr
where verbosity = fromFlag (regVerbose flags)
-- ------------------------------------------------------------
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
simpleHunitTests :: [Test]
simpleHunitTests = []
#endif
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Build
......@@ -44,9 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.Build (
build, makefile, initialBuildSteps
#ifdef DEBUG
,hunitTests
#endif
) where
import Distribution.Simple.Compiler ( Compiler(..), CompilerFlavor(..) )
......@@ -81,10 +77,6 @@ import qualified Distribution.Simple.Hugs as Hugs
import Distribution.PackageDescription (hasLibs)
import Distribution.Verbosity
#ifdef DEBUG
import Test.HUnit (Test)
#endif
-- -----------------------------------------------------------------------------
-- |Build the libraries and executables in this package.
......@@ -335,12 +327,3 @@ filename_stuff =
(case os of
Windows _ -> "isPathSeparator c = c == '/' || c == '\\\\'\n"
_ -> "isPathSeparator c = c == '/'\n")
-- ------------------------------------------------------------
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: [Test]
hunitTests = []
#endif
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Compiler
......@@ -53,9 +52,6 @@ module Distribution.Simple.Compiler (
Flag,
extensionsToFlags,
unsupportedExtensions
#ifdef DEBUG
,hunitTests
#endif
) where
import Distribution.Compiler
......@@ -66,10 +62,6 @@ import Language.Haskell.Extension (Extension(..))
import Data.List (nub)
import Data.Maybe (catMaybes, isNothing)
#ifdef DEBUG
import Test.HUnit (Test)
#endif
data Compiler = Compiler {
compilerFlavor :: CompilerFlavor,
compilerId :: PackageIdentifier,
......@@ -116,12 +108,3 @@ extensionsToFlags comp exts =
nub $ filter (not . null) $ catMaybes
[ lookup ext (compilerExtensions comp)
| ext <- exts ]
-- ------------------------------------------------------------
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: [Test]
hunitTests = []
#endif
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Configure
......@@ -52,9 +51,6 @@ module Distribution.Simple.Configure (configure,
configDependency,
configCompiler, configCompilerAux,
ccLdOptionsBuildInfo,
#ifdef DEBUG
hunitTests
#endif
)
where
......@@ -129,10 +125,6 @@ import Text.PrettyPrint.HughesPJ
import Prelude hiding (catch)
#ifdef DEBUG
import Test.HUnit
#endif
tryGetConfigStateFile :: (Read a) => FilePath -> IO (Either String a)
tryGetConfigStateFile filename = do
e <- doesFileExist filename
......@@ -521,11 +513,9 @@ errorOut verbosity warnings errors = do
-- -----------------------------------------------------------------------------
-- Tests
#ifdef DEBUG
{- Too specific:
hunitTests :: [Test]
hunitTests = []
{- Too specific:
packageID = PackageIdentifier "Foo" (Version [1] [])
= [TestCase $
do let simonMarGHCLoc = "/usr/bin/ghc"
......@@ -540,4 +530,3 @@ packageID = PackageIdentifier "Foo" (Version [1] [])
simonMarGHC
]
-}
#endif
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Install
......@@ -44,9 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.Install (
install,
#ifdef DEBUG
hunitTests
#endif
) where
import Distribution.PackageDescription (
......@@ -71,10 +67,6 @@ import System.FilePath(takeDirectory, (</>), isAbsolute)
import Distribution.Verbosity
#ifdef DEBUG
import Test.HUnit (Test)
#endif
-- |Perform the \"@.\/setup install@\" and \"@.\/setup copy@\"
-- actions. Move files into place based on the prefix argument. FIX:
-- nhc isn't implemented yet.
......@@ -168,11 +160,3 @@ installIncludeFiles verbosity PackageDescription{library=Just l} incdir
b <- doesFileExist path
if b then return (f,path) else findInc ds f
installIncludeFiles _ _ _ = die "installIncludeFiles: Can't happen?"
-- ------------------------------------------------------------
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: [Test]
hunitTests = []
#endif
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Register
......@@ -48,9 +47,6 @@ module Distribution.Simple.Register (
writeInstalledConfig,
removeInstalledConfig,
removeRegScripts,
#ifdef DEBUG
hunitTests, installedPkgConfigFile
#endif
) where
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), distPref,
......@@ -86,10 +82,6 @@ import Control.Monad (when)
import Data.Maybe (isNothing, isJust, fromJust, fromMaybe)
import Data.List (partition)
#ifdef DEBUG
import Test.HUnit (Test)
#endif
regScriptLocation :: FilePath
regScriptLocation = case os of
Windows _ -> "register.bat"
......@@ -348,12 +340,3 @@ rawSystemPipe prog scriptName pipeFrom extraArgs
escapeForShell (c :cs) = c : escapeForShell cs
args = programArgs prog ++ extraArgs
path = programPath prog
-- ------------------------------------------------------------
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: [Test]
hunitTests = []
#endif
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Setup
......@@ -68,18 +67,8 @@ module Distribution.Simple.Setup (
fromFlagOrDefault,
flagToMaybe,
flagToList,
#ifdef DEBUG
hunitTests,
#endif
) where
-- Misc:
#ifdef DEBUG
import Test.HUnit (Test(..))
#endif
import Distribution.Simple.Command
import Distribution.Simple.Compiler (CompilerFlavor(..), Compiler(..),
defaultCompilerFlavor, PackageDB(..))
......@@ -1254,10 +1243,8 @@ splitArgs = space []
word [] s = s
word w s = reverse w : s
#ifdef DEBUG
hunitTests :: [Test]
hunitTests = []
-- The test cases kinda have to be rewritten from the ground up... :/
--hunitTests :: [Test]
--hunitTests =
-- let m = [("ghc", GHC), ("nhc98", NHC), ("hugs", Hugs)]
-- (flags, commands', unkFlags, ers)
......@@ -1293,12 +1280,9 @@ hunitTests = []
-- ("register", RegisterCmd False)]
-- ]
-- ]
#endif
{- Testing ideas:
* IO to look for hugs and hugs-pkg (which hugs, etc)
* quickCheck to test permutations of arguments
* what other options can we over-ride with a command-line flag?
-}
{-# OPTIONS -cpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.SrcDist
......@@ -52,9 +51,6 @@ module Distribution.Simple.SrcDist (
,prepareTree
,tarBallName
,copyFileTo
#ifdef DEBUG
,hunitTests
#endif
) where
import Distribution.PackageDescription
......@@ -82,10 +78,6 @@ import System.Directory (doesFileExist, doesDirectoryExist,
import Distribution.Verbosity
import System.FilePath ((</>), takeDirectory, isAbsolute)
#ifdef DEBUG
import Test.HUnit (Test)
#endif
-- |Create a source distribution.
sdist :: PackageDescription -- ^information from the tarball
-> Maybe LocalBuildInfo -- ^Information from configure
......@@ -263,12 +255,3 @@ tarBallName p = (nameVersion p) ++ ".tar.gz"
nameVersion :: PackageDescription -> String
nameVersion = showPackageId . package
-- ------------------------------------------------------------
-- * Testing
-- ------------------------------------------------------------
#ifdef DEBUG
hunitTests :: [Test]
hunitTests = []
#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