add some test

This commit is contained in:
Yann Esposito (Yogsototh) 2013-11-27 15:57:49 +01:00
parent b2df76b617
commit 55469c6137
6 changed files with 28 additions and 21 deletions

View file

@ -56,7 +56,7 @@ executable holy-project
library
exposed-modules: HolyProject
, HolyProject.Swallow
, HolyProject.StringUtils
, HolyProject.Coconut
-- other-modules:
-- other-extensions:

View file

@ -1,5 +1,7 @@
{-# LANGUAGE OverloadedStrings #-}
module HolyProject.GitHubAPI where
module HolyProject.GitHubAPI
(searchGHUserFromEmail)
where
import qualified Data.ByteString.Lazy.Char8 as LZ
-- HTTP request and JSON handling

View file

@ -1,4 +0,0 @@
module HolyProject.Swallow (swallow) where
swallow :: String -> String -> String
swallow prefix suffix = prefix ++ suffix

View file

@ -0,0 +1,22 @@
module HolyProject.StringUtils.Test
( stringUtilsSuite
) where
import Test.Tasty (testGroup, TestTree)
import Test.Tasty.HUnit
import HolyProject.StringUtils
stringUtilsSuite :: TestTree
stringUtilsSuite = testGroup "StringUtils"
[ testCase "projectNameFromString space"
(testProjectNameFromString "Holy Project" "holy-project")
, testCase "projectNameFromString dash"
(testProjectNameFromString "Holy-Project" "holy-project")
, testCase "projectNameFromString caps"
(testProjectNameFromString "Holy PROJECT" "holy-project")
, testCase "projectNameFromString underscore"
(testProjectNameFromString "Holy_PROJECT" "holy_project")
]
testProjectNameFromString :: String -> String -> Assertion
testProjectNameFromString input expectedoutput =
expectedoutput @=? projectNameFromString input

View file

@ -1,13 +0,0 @@
module HolyProject.Swallow.Test
(swallowSuite)
where
import Test.Tasty (testGroup, TestTree)
import Test.Tasty.HUnit
import HolyProject.Swallow
swallowSuite :: TestTree
swallowSuite = testGroup "Swallow"
[testCase "swallow test" testSwallow]
testSwallow :: Assertion
testSwallow = "something" @=? swallow "some" "thing"

View file

@ -2,7 +2,7 @@ module Main where
import Test.Tasty (defaultMain,testGroup,TestTree)
import HolyProject.Swallow.Test
import HolyProject.StringUtils.Test
import HolyProject.Coconut.Test
main :: IO ()
@ -10,6 +10,6 @@ main = defaultMain tests
tests :: TestTree
tests = testGroup "All Tests"
[ swallowSuite
[ stringUtilsSuite
, coconutSuite
]