Permalink
Browse files

Update to 'cabal test'

* Cabal >= 1.9.2 now required
* Setup.lhs is much simpler
  • Loading branch information...
1 parent e6bba68 commit 1a10e1a026da0c7a3eb6633650dcc4b23ed3cacf @spl committed May 28, 2012
Showing with 16 additions and 42 deletions.
  1. +3 −35 Setup.lhs
  2. +4 −4 tests/Main.hs
  3. +9 −3 xformat.cabal
View
@@ -6,50 +6,18 @@
-----------------------------------------------------------------------------
-- |
-- Module : Setup
--- Copyright : (c) 2009 Sean Leather
+-- Copyright : (c) 2009-2012 Sean Leather
-- License : BSD3
--
-- Maintainer : leather@cs.uu.nl
-----------------------------------------------------------------------------
module Main (main) where
-import System.Cmd
- ( system
- )
-
-import System.FilePath
- ( (</>)
- )
-
-import Distribution.Simple
- ( defaultMainWithHooks
- , simpleUserHooks
- , UserHooks(runTests)
- , Args
- )
-
-import Distribution.Simple.LocalBuildInfo
- ( LocalBuildInfo
- )
-
-import Distribution.PackageDescription
- ( PackageDescription
- )
+import Distribution.Simple (defaultMain)
main :: IO ()
-main = defaultMainWithHooks hooks
- where
- hooks = simpleUserHooks
- { runTests = runTests'
- }
-
--- Run a 'test' binary that gets built when configured with '-ftest'.
-runTests' :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
-runTests' _ _ _ _ = system cmd >> return ()
- where testdir = "dist" </> "build" </> "test"
- testcmd = "." </> "test"
- cmd = "cd " ++ testdir ++ " && " ++ testcmd
+main = defaultMain
\end{code}
View
@@ -2,7 +2,7 @@
--------------------------------------------------------------------------------
-- |
-- Module : Main
--- Copyright : (c) 2009 Sean Leather
+-- Copyright : (c) 2009-2012 Sean Leather
-- License : BSD3
--
-- Maintainer : leather@cs.uu.nl
@@ -12,6 +12,8 @@
module Main where
+import System.Exit (exitFailure, exitSuccess)
+
import qualified Read (test)
import qualified Show (test)
@@ -22,7 +24,5 @@ test = and
]
main :: IO ()
-main =
- do putStrLn "Running tests for Text.XFormat.* ..."
- putStrLn $ "Result: " ++ if test then "Passed. :)" else "FAILED!!! :("
+main = if test then exitSuccess else exitFailure
View
@@ -1,5 +1,5 @@
name: xformat
-version: 0.1.1
+version: 0.1.2
synopsis:
Extensible, type-safe formatting with scanf- and printf-like functions
@@ -36,8 +36,8 @@ license-file: LICENSE
author: Sean Leather
maintainer: leather@cs.uu.nl
stability: experimental
-build-type: Custom
-cabal-version: >= 1.2.1
+build-type: Simple
+cabal-version: >= 1.9.2
tested-with: GHC == 6.8.3, GHC == 6.10.1, GHC == 7.4.1
--------------------------------------------------------------------------------
@@ -52,3 +52,9 @@ Library
ghc-options: -Wall -O2
+Test-Suite test
+ type: exitcode-stdio-1.0
+ hs-source-dirs: tests, src
+ main-is: Main.hs
+ build-depends: base >= 3.0 && < 5.0
+

0 comments on commit 1a10e1a

Please sign in to comment.