test for Lint.

This commit is contained in:
Kazu Yamamoto 2013-02-12 14:31:01 +09:00
parent d115c1dacb
commit 23045b5312
3 changed files with 19 additions and 0 deletions

View File

@ -70,6 +70,7 @@ Test-Suite spec
BrowseSpec BrowseSpec
FlagSpec FlagSpec
LangSpec LangSpec
LintSpec
ListSpec ListSpec
Build-Depends: base >= 4.0 && < 5 Build-Depends: base >= 4.0 && < 5
, Cabal >= 1.10 , Cabal >= 1.10

13
test/LintSpec.hs Normal file
View File

@ -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"

5
test/data/hlint.hs Normal file
View File

@ -0,0 +1,5 @@
module Hlist where
main :: IO ()
main = do
putStrLn "Hello, world!"