test with IO

This commit is contained in:
Yann Esposito (Yogsototh) 2013-12-03 11:56:33 +01:00
parent e37066a61a
commit 9dd6b42216
3 changed files with 25 additions and 0 deletions

View file

@ -57,6 +57,7 @@ executable holy-project
library
exposed-modules: HolyProject
, HolyProject.StringUtils
, HolyProject.GithubAPI
, HolyProject.Coconut
-- other-modules:
-- other-extensions:

View file

@ -0,0 +1,22 @@
module HolyProject.GithubAPI.Test
( githubAPISuite
) where
import Test.Tasty (testGroup, TestTree)
import Test.Tasty.HUnit
import HolyProject.GithubAPI
githubAPISuite :: TestTree
githubAPISuite = testGroup "GithubAPI"
[ testCase "Yann"
(ioTestEq
(searchGHUserFromEmail "Yann.Esposito@gmail.com")
(Just "\"yogsototh\""))
, testCase "Jasper"
(ioTestEq
(searchGHUserFromEmail "Jasper Van der Jeugt")
(Just "\"jaspervdj\""))
]
ioTestEq :: (Eq a, Show a) => IO a -> a -> Assertion
ioTestEq action expected = action >>= assertEqual "" expected

View file

@ -3,6 +3,7 @@ module Main where
import Test.Tasty (defaultMain,testGroup,TestTree)
import HolyProject.StringUtils.Test
import HolyProject.GithubAPI.Test
import HolyProject.Coconut.Test
main :: IO ()
@ -11,5 +12,6 @@ main = defaultMain tests
tests :: TestTree
tests = testGroup "All Tests"
[ stringUtilsSuite
, githubAPISuite
, coconutSuite
]