]> git.wincent.com - docvim.git/commitdiff
Set up test suite for running HLint from cabal
authorGreg Hurrell <greg@hurrell.net>
Sun, 20 Mar 2016 05:44:23 +0000 (22:44 -0700)
committerGreg Hurrell <greg@hurrell.net>
Sun, 20 Mar 2016 05:44:23 +0000 (22:44 -0700)
With:

    cabal test

After one-time set-up:

    cabal configure --enable -tests

README.md
docvim.cabal
tests/HLint.hs [new file with mode: 0644]

index 1ce7c0307858f98fd95cd524704c992c767fde5c..5a0a3a95a4570d713d5dd2d84ed4299e06fcf7c0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -32,5 +32,6 @@ open dist/doc/html/docvim/docvim/index.html
 
 ```
 cabal install hlint
 
 ```
 cabal install hlint
-hlint src
+hlint src # or, alternatively...
+cabal test
 ```
 ```
index 432a269b9929abfa780febcbc185f5ec94b89ee0..f231d67a20dc211c0642de2f23265e132fb0eea3 100644 (file)
@@ -35,7 +35,7 @@ author:              Greg Hurrell
 maintainer:          greg@hurrell.net
 
 -- A copyright notice.
 maintainer:          greg@hurrell.net
 
 -- A copyright notice.
--- copyright:
+copyright:           2015-present Greg Hurrell
 
 category:            Development
 
 
 category:            Development
 
@@ -74,3 +74,9 @@ executable docvim
   -- Base language which the package is written in.
   default-language:    Haskell2010
 
   -- Base language which the package is written in.
   default-language:    Haskell2010
 
+test-suite hlint
+  build-depends:    base, hlint
+  default-language: Haskell2010
+  hs-source-dirs:   tests
+  main-is:          HLint.hs
+  type:             exitcode-stdio-1.0
diff --git a/tests/HLint.hs b/tests/HLint.hs
new file mode 100644 (file)
index 0000000..9474fc3
--- /dev/null
@@ -0,0 +1,9 @@
+module Main (main) where
+
+import Language.Haskell.HLint (hlint)
+import System.Exit (exitFailure, exitSuccess)
+
+main :: IO ()
+main = do
+  hints <- hlint ["src"]
+  if null hints then exitSuccess else exitFailure