a test case for info.

This commit is contained in:
Kazu Yamamoto 2013-03-30 21:24:57 +09:00
parent 5aabca1e99
commit b87a1e0e39
2 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,12 @@ spec = do
res `shouldBe` unlines ["3 8 3 16 \"String -> IO ()\"", "3 8 3 20 \"IO ()\"", "3 1 3 20 \"IO ()\""]
describe "infoExpr" $ do
it "works for non-export functions" $ do
withDirectory_ "test/data" $ do
cradle <- getGHCVersion >>= findCradle Nothing . fst
res <- infoExpr defaultOptions cradle "Info" "fib" "Info.hs"
res `shouldSatisfy` ("fib :: Int -> Int" `isPrefixOf`)
it "works with a module using TemplateHaskell" $ do
withDirectory_ "test/data" $ do
cradle <- getGHCVersion >>= findCradle Nothing . fst

6
test/data/Info.hs Normal file
View File

@ -0,0 +1,6 @@
module Info () where
fib :: Int -> Int
fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)