adding tests.
This commit is contained in:
parent
e42a7e8bcb
commit
418c39b759
@ -62,6 +62,32 @@ Executable ghc-mod
|
|||||||
, time
|
, time
|
||||||
, transformers
|
, transformers
|
||||||
|
|
||||||
|
Test-Suite spec
|
||||||
|
Main-Is: Spec.hs
|
||||||
|
Hs-Source-Dirs: test, .
|
||||||
|
Type: exitcode-stdio-1.0
|
||||||
|
Other-Modules: Expectation
|
||||||
|
LangSpec
|
||||||
|
ListSpec
|
||||||
|
Build-Depends: base >= 4.0 && < 5
|
||||||
|
, Cabal >= 1.10
|
||||||
|
, containers
|
||||||
|
, convertible
|
||||||
|
, directory
|
||||||
|
, filepath
|
||||||
|
, ghc
|
||||||
|
, ghc-paths
|
||||||
|
, ghc-syb-utils
|
||||||
|
, hlint >= 1.7.1
|
||||||
|
, io-choice
|
||||||
|
, old-time
|
||||||
|
, process
|
||||||
|
, regex-posix
|
||||||
|
, syb
|
||||||
|
, time
|
||||||
|
, transformers
|
||||||
|
, hspec
|
||||||
|
|
||||||
Source-Repository head
|
Source-Repository head
|
||||||
Type: git
|
Type: git
|
||||||
Location: git://github.com/kazu-yamamoto/ghc-mod.git
|
Location: git://github.com/kazu-yamamoto/ghc-mod.git
|
||||||
|
8
test/Expectation.hs
Normal file
8
test/Expectation.hs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module Expectation where
|
||||||
|
|
||||||
|
import Test.Hspec
|
||||||
|
|
||||||
|
shouldContain :: Eq a => [a] -> a -> Expectation
|
||||||
|
shouldContain containers element = do
|
||||||
|
let res = element `elem` containers
|
||||||
|
res `shouldBe` True
|
14
test/LangSpec.hs
Normal file
14
test/LangSpec.hs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module LangSpec where
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
import Test.Hspec
|
||||||
|
import Expectation
|
||||||
|
import Lang
|
||||||
|
import Types
|
||||||
|
|
||||||
|
spec :: Spec
|
||||||
|
spec = do
|
||||||
|
describe "listLanguages" $ do
|
||||||
|
it "lists up language extensions" $ do
|
||||||
|
modules <- lines <$> listLanguages defaultOptions
|
||||||
|
modules `shouldContain` "OverloadedStrings"
|
14
test/ListSpec.hs
Normal file
14
test/ListSpec.hs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module ListSpec where
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
import Test.Hspec
|
||||||
|
import Expectation
|
||||||
|
import List
|
||||||
|
import Types
|
||||||
|
|
||||||
|
spec :: Spec
|
||||||
|
spec = do
|
||||||
|
describe "listModules" $ do
|
||||||
|
it "lists up module names" $ do
|
||||||
|
modules <- lines <$> listModules defaultOptions
|
||||||
|
modules `shouldContain` "Data.Map"
|
1
test/Spec.hs
Normal file
1
test/Spec.hs
Normal file
@ -0,0 +1 @@
|
|||||||
|
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
|
Loading…
Reference in New Issue
Block a user