ghc-mod/test/BrowseSpec.hs

25 lines
958 B
Haskell
Raw Normal View History

2013-02-12 05:18:19 +00:00
module BrowseSpec where
import Control.Applicative
2013-05-20 02:29:44 +00:00
import Language.Haskell.GhcMod
import Test.Hspec
2013-02-12 05:18:19 +00:00
spec :: Spec
spec = do
describe "browseModule" $ do
it "lists up symbols in the module" $ do
cradle <- findCradle
syms <- lines <$> browseModule defaultOptions cradle "Data.Map"
syms `shouldContain` ["differenceWithKey"]
2013-03-01 00:46:17 +00:00
describe "browseModule -d" $ do
it "lists up symbols with type info in the module" $ do
cradle <- findCradle
syms <- lines <$> browseModule defaultOptions { detailed = True } cradle "Data.Either"
syms `shouldContain` ["either :: (a -> c) -> (b -> c) -> Either a b -> c"]
it "lists up data constructors with type info in the module" $ do
cradle <- findCradle
syms <- lines <$> browseModule defaultOptions { detailed = True} cradle "Data.Either"
syms `shouldContain` ["Left :: a -> Either a b"]