Merge branch 'master' of github.com:yogsototh/holy-project

This commit is contained in:
Yann Esposito (Yogsototh) 2013-11-30 22:03:03 +01:00
commit 76f797700d
7 changed files with 47 additions and 25 deletions

View file

@ -1,11 +1,26 @@
#!/usr/bin/env zsh
autoload colors
colors
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
eval $COLOR='$fg_no_bold[${(L)COLOR}]'
eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]'
done
eval RESET='$reset_color'
latestThread=0
relaunchCompilation() {
while read line; do
if (( $( print -- $line | grep '.cabal-sandbox' | wc -l) == 0 )); then
print "$line"
cabal install && \
./.cabal-sandbox/bin/test-holy-project
(($latestThread>0)) && \
(( $(ps x | awk "\$1 == $latestThread" | wc -l)>0 )) && {
print -- "\n${RED}STOPPED${RESET}"
kill $latestThread
}
print "${BLUE}$line${RESET}"
{ cabal install && \
./.cabal-sandbox/bin/test-holy-project } &
latestThread=$!
fi
done
}
@ -22,7 +37,7 @@ Darwin)
tmp=$(date +"%s")
t=$tmp
while true; do
tmp=$t
tmp=$(( $t - 1 ))
t=$(date +"%s")
for fic in {src,test}/**/*.hs(.) *.cabal; do
# note to use on OS X, use "stat -f %m $checkfile" instead

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
]