2013-02-12 05:31:01 +00:00
|
|
|
module LintSpec where
|
|
|
|
|
2017-01-12 15:36:47 +00:00
|
|
|
import GhcMod
|
2013-02-12 05:31:01 +00:00
|
|
|
import Test.Hspec
|
2014-07-11 01:10:37 +00:00
|
|
|
import TestUtils
|
2013-02-12 05:31:01 +00:00
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = do
|
2014-07-11 01:10:37 +00:00
|
|
|
describe "lint" $ do
|
|
|
|
it "can detect a redundant import" $ do
|
2017-05-25 01:26:33 +00:00
|
|
|
res <- runD $ lint lintOpts "test/data/hlint/hlint.hs"
|
2016-02-09 09:51:28 +00:00
|
|
|
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"
|
2013-02-12 05:31:01 +00:00
|
|
|
|
2014-07-11 01:10:37 +00:00
|
|
|
context "when no suggestions are given" $ do
|
|
|
|
it "doesn't output an empty line" $ do
|
2017-05-25 01:26:33 +00:00
|
|
|
res <- runD $ lint lintOpts "test/data/ghc-mod-check/lib/Data/Foo.hs"
|
2014-05-10 15:25:44 +00:00
|
|
|
res `shouldBe` ""
|
2017-05-25 01:26:33 +00:00
|
|
|
|
|
|
|
lintOpts :: LintOpts
|
|
|
|
lintOpts =
|
|
|
|
defaultLintOpts { optLintHlintOpts = ["--ignore=Use module export list"] }
|