Skip to content

Commit

Permalink
support for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tonymorris committed Nov 21, 2011
1 parent 2a586f3 commit 544a440
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/M.hs
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
module M where

add ::
Int
-> Int
-> Int
add =
(+)

6 changes: 6 additions & 0 deletions test/.ghci
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:set -i../src -isrc
:m + Test.QuickCheck
:l Main
:set prompt "test>> "
:set -Wall

3 changes: 3 additions & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
*.pix
.hpc
39 changes: 39 additions & 0 deletions test/Package-Test.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Name: Haskell-Package-Test
Version: 0.0.1
Author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>
Maintainer: Tony Morris
Copyright: Tony Morris
Synopsis: A skeleton for testing haskell packages
Category: Development
Description: A skeleton for testing haskell packages
Homepage: https://github.com/tonymorris/haskell-package
Cabal-Version: >= 1.6
Build-Type: Simple

Source-Repository head
Type: git
Location: [email protected]:tonymorris/haskell-package.git

Flag small_base
Description: Choose the new, split-up base package.

Executable package-test
Hs-Source-Dirs:
../src src

Main-Is:
Main.hs

Ghc-Options:
-O2
-Wall
-fhpc
-fwarn-tabs

Build-Depends:
base < 5 && >= 3
, QuickCheck
, test-framework
, test-framework-quickcheck2
, test-framework-hunit

1 change: 1 addition & 0 deletions test/package-test.tix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tix [ TixModule "Main" 2831685652 9 [1,1,1,1,1,1,1,1,1], TixModule "M.Tests" 2707333672 17 [100,1,100,100,100,100,1,1,1,1,1,1,1,0,0,0,0], TixModule "M" 1390508605 2 [100,100]]
29 changes: 29 additions & 0 deletions test/src/M/Tests.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module M.Tests
(
main
, test
) where

import Test.Framework
import Test.Framework.Providers.QuickCheck2 (testProperty)
import M

main ::
IO ()
main =
defaultMain [test]

test ::
Test
test =
testGroup "M"
[
testProperty "Right Identity" prop_right_identity
]

prop_right_identity ::
Int
-> Bool
prop_right_identity n =
n `add` 0 == n

20 changes: 20 additions & 0 deletions test/src/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Main where

import qualified M.Tests
import Test.Framework

main ::
IO ()
main =
defaultMain tests

tests ::
[Test]
tests =
[
testGroup "Tests"
[
M.Tests.test
]
]

0 comments on commit 544a440

Please sign in to comment.