adding tests.
This commit is contained in:
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 #-}
|
||||
Reference in New Issue
Block a user