Bump dependency on HLint to 2.*

This commit is contained in:
Daniel Gröber 2017-05-25 03:26:33 +02:00
parent e2490a1cf0
commit efca8f8270
3 changed files with 16 additions and 7 deletions

View File

@ -190,7 +190,7 @@ Library
, ghc-paths < 0.2 && >= 0.1.0.9 , ghc-paths < 0.2 && >= 0.1.0.9
, ghc-syb-utils < 0.3 && >= 0.2.3 , ghc-syb-utils < 0.3 && >= 0.2.3
, haskell-src-exts < 1.20 && >= 1.18 , haskell-src-exts < 1.20 && >= 1.18
, hlint < 1.10 && >= 1.9.27 , hlint < 2.1 && >= 2.0.8
, monad-control < 1.1 && >= 1 , monad-control < 1.1 && >= 1
, monad-journal < 0.8 && >= 0.4 , monad-journal < 0.8 && >= 0.4
, optparse-applicative == 0.13.0.* , optparse-applicative == 0.13.0.*

View File

@ -122,13 +122,13 @@ spec = do
withDirectory_ "test/data/file-mapping" $ do withDirectory_ "test/data/file-mapping" $ do
res <- runD $ do res <- runD $ do
loadMappedFile "File.hs" "File_Redir_Lint.hs" loadMappedFile "File.hs" "File_Redir_Lint.hs"
lint defaultLintOpts "File.hs" lint lintOpts "File.hs"
res `shouldBe` "File.hs:4:1: Warning: Eta reduce\NULFound:\NUL func a b = (*) a b\NULWhy not:\NUL func = (*)\n" res `shouldBe` "File.hs:4:1: Warning: Eta reduce\NULFound:\NUL func a b = (*) a b\NULWhy not:\NUL func = (*)\n"
it "lints in-memory file if one is specified and outputs original filename" $ do it "lints in-memory file if one is specified and outputs original filename" $ do
withDirectory_ "test/data/file-mapping" $ do withDirectory_ "test/data/file-mapping" $ do
res <- runD $ do res <- runD $ do
loadMappedFileSource "File.hs" "func a b = (++) a b\n" loadMappedFileSource "File.hs" "func a b = (++) a b\n"
lint defaultLintOpts "File.hs" lint lintOpts "File.hs"
res `shouldBe` "File.hs:1:1: Warning: Eta reduce\NULFound:\NUL func a b = (++) a b\NULWhy not:\NUL func = (++)\n" res `shouldBe` "File.hs:1:1: Warning: Eta reduce\NULFound:\NUL func a b = (++) a b\NULWhy not:\NUL func = (++)\n"
it "shows types of the expression for redirected files" $ do it "shows types of the expression for redirected files" $ do
let tdir = "test/data/file-mapping" let tdir = "test/data/file-mapping"
@ -189,14 +189,14 @@ spec = do
withDirectory_ "test/data/file-mapping/preprocessor" $ do withDirectory_ "test/data/file-mapping/preprocessor" $ do
res <- runD $ do res <- runD $ do
loadMappedFile "File.hs" "File_Redir_Lint.hs" loadMappedFile "File.hs" "File_Redir_Lint.hs"
lint defaultLintOpts "File.hs" lint lintOpts "File.hs"
res `shouldBe` "File.hs:6:1: Warning: Eta reduce\NULFound:\NUL func a b = (*) a b\NULWhy not:\NUL func = (*)\n" res `shouldBe` "File.hs:6:1: Warning: Eta reduce\NULFound:\NUL func a b = (*) a b\NULWhy not:\NUL func = (*)\n"
it "lints in-memory file if one is specified and outputs original filename" $ do it "lints in-memory file if one is specified and outputs original filename" $ do
withDirectory_ "test/data/file-mapping/preprocessor" $ do withDirectory_ "test/data/file-mapping/preprocessor" $ do
src <- readFile "File_Redir_Lint.hs" src <- readFile "File_Redir_Lint.hs"
res <- runD $ do res <- runD $ do
loadMappedFileSource "File.hs" src loadMappedFileSource "File.hs" src
lint defaultLintOpts "File.hs" lint lintOpts "File.hs"
res `shouldBe` "File.hs:6:1: Warning: Eta reduce\NULFound:\NUL func a b = (*) a b\NULWhy not:\NUL func = (*)\n" res `shouldBe` "File.hs:6:1: Warning: Eta reduce\NULFound:\NUL func a b = (*) a b\NULWhy not:\NUL func = (*)\n"
describe "literate haskell tests" $ do describe "literate haskell tests" $ do
it "checks redirected file if one is specified and outputs original filename" $ do it "checks redirected file if one is specified and outputs original filename" $ do
@ -252,3 +252,8 @@ spec = do
mapM_ (uncurry loadMappedFileSource) fm mapM_ (uncurry loadMappedFileSource) fm
types False "Bar.hs" 5 1 types False "Bar.hs" 5 1
res `shouldBe` unlines ["5 1 5 20 \"[Char]\""] res `shouldBe` unlines ["5 1 5 20 \"[Char]\""]
lintOpts :: LintOpts
lintOpts =
defaultLintOpts { optLintHlintOpts = ["--ignore=Use module export list"] }

View File

@ -8,10 +8,14 @@ spec :: Spec
spec = do spec = do
describe "lint" $ do describe "lint" $ do
it "can detect a redundant import" $ do it "can detect a redundant import" $ do
res <- runD $ lint defaultLintOpts "test/data/hlint/hlint.hs" res <- runD $ lint lintOpts "test/data/hlint/hlint.hs"
res `shouldBe` "test/data/hlint/hlint.hs:4:8: Warning: Redundant do\NULFound:\NUL do putStrLn \"Hello, world!\"\NULWhy not:\NUL putStrLn \"Hello, world!\"\n" res `shouldBe` "test/data/hlint/hlint.hs:4:8: Warning: Redundant do\NULFound:\NUL do putStrLn \"Hello, world!\"\NULWhy not:\NUL putStrLn \"Hello, world!\"\n"
context "when no suggestions are given" $ do context "when no suggestions are given" $ do
it "doesn't output an empty line" $ do it "doesn't output an empty line" $ do
res <- runD $ lint defaultLintOpts "test/data/ghc-mod-check/lib/Data/Foo.hs" res <- runD $ lint lintOpts "test/data/ghc-mod-check/lib/Data/Foo.hs"
res `shouldBe` "" res `shouldBe` ""
lintOpts :: LintOpts
lintOpts =
defaultLintOpts { optLintHlintOpts = ["--ignore=Use module export list"] }