From 23045b53128d16addfa8373d65da954076b12f04 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 12 Feb 2013 14:31:01 +0900 Subject: [PATCH] test for Lint. --- ghc-mod.cabal | 1 + test/LintSpec.hs | 13 +++++++++++++ test/data/hlint.hs | 5 +++++ 3 files changed, 19 insertions(+) create mode 100644 test/LintSpec.hs create mode 100644 test/data/hlint.hs diff --git a/ghc-mod.cabal b/ghc-mod.cabal index d16e984..9f1969e 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -70,6 +70,7 @@ Test-Suite spec BrowseSpec FlagSpec LangSpec + LintSpec ListSpec Build-Depends: base >= 4.0 && < 5 , Cabal >= 1.10 diff --git a/test/LintSpec.hs b/test/LintSpec.hs new file mode 100644 index 0000000..e4eaebb --- /dev/null +++ b/test/LintSpec.hs @@ -0,0 +1,13 @@ +module LintSpec where + +import Test.Hspec +import Lint +import Types + +spec :: Spec +spec = do + describe "lintSyntax" $ do + it "check syntax with HList" $ do + res <- lintSyntax defaultOptions "test/data/hlint.hs" + res `shouldBe` "test/data/hlint.hs:4:8: Error: Redundant do\NULFound:\NUL do putStrLn \"Hello, world!\"\NULWhy not:\NUL putStrLn \"Hello, world!\"\n" + diff --git a/test/data/hlint.hs b/test/data/hlint.hs new file mode 100644 index 0000000..b721607 --- /dev/null +++ b/test/data/hlint.hs @@ -0,0 +1,5 @@ +module Hlist where + +main :: IO () +main = do + putStrLn "Hello, world!"