From 4d696f5ad4293ef2cd3bde406b12ea319bc0d249 Mon Sep 17 00:00:00 2001 From: Nikos Baxevanis Date: Thu, 29 Jan 2015 16:18:49 +0200 Subject: [PATCH] Added HLint to the pipeline of test suites. Notice the --reorder-goals switch in cabal install. More information about it can be found at: https://github.com/haskell/cabal/issues/1780/. --- HLint.hs | 7 +++++++ README | 5 ++++- quickcheck-samples.cabal | 9 +++++++++ tests/HLint.hs | 16 ++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 HLint.hs create mode 100644 tests/HLint.hs diff --git a/HLint.hs b/HLint.hs new file mode 100644 index 0000000..99ee203 --- /dev/null +++ b/HLint.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE PackageImports #-} + +module HLint () where + +import "hint" HLint.Default +import "hint" HLint.Dollar +import "hint" HLint.Generalise diff --git a/README b/README index 1886824..9ab76bf 100644 --- a/README +++ b/README @@ -4,7 +4,10 @@ cabal update # Download the most recent list of packages cabal install cabal-install # Optional, can be prompted by cabal update cabal sandbox init # Initialise the sandbox -cabal install --only-dependencies # Install dependencies into the sandbox +cabal install \ # Install dependencies into the sandbox + --enable-tests \ + --only-dependencies \ + --reorder-goals cabal build # Build your package inside the sandbox cabal configure --enable-tests # Enable the test suites diff --git a/quickcheck-samples.cabal b/quickcheck-samples.cabal index 6981615..8ad8b92 100644 --- a/quickcheck-samples.cabal +++ b/quickcheck-samples.cabal @@ -20,3 +20,12 @@ Test-Suite spec Build-Depends: base , hspec , QuickCheck + +Test-Suite style + Type: exitcode-stdio-1.0 + Default-Language: Haskell2010 + Hs-Source-Dirs: tests + Ghc-Options: -Wall + Main-Is: HLint.hs + Build-Depends: base + , hlint == 1.* diff --git a/tests/HLint.hs b/tests/HLint.hs new file mode 100644 index 0000000..6cf63d0 --- /dev/null +++ b/tests/HLint.hs @@ -0,0 +1,16 @@ +module Main (main) where + +import Language.Haskell.HLint (hlint) +import System.Exit (exitFailure, exitSuccess) + +arguments :: [String] +arguments = + [ "tests" + ] + +main :: IO () +main = do + hints <- hlint arguments + if null hints + then exitSuccess + else exitFailure