Skip to content

Commit

Permalink
Add fledgeling test suite
Browse files Browse the repository at this point in the history
We should really get this to run all of the tests in the tests directory
instead.
  • Loading branch information
snoyberg committed Feb 17, 2015
1 parent 7465cd7 commit 95f12a7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ script:
- cabal build
- cabal check
- cabal sdist
- cabal test
# The following scriptlet checks that the resulting source distribution can be built & installed
- export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
cd dist/;
Expand Down
9 changes: 9 additions & 0 deletions directory.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ Library

ghc-options: -Wall

test-suite test
default-language: Haskell2010
hs-source-dirs: test
main-is: main.hs
type: exitcode-stdio-1.0
build-depends: base
, directory
, containers

source-repository head
type: git
location: https://github.com/haskell/directory
20 changes: 20 additions & 0 deletions test/main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{-# LANGUAGE NoImplicitPrelude #-}
-- Simplistic test suite for now. Worthwhile to add a dependency on a
-- test framework at some point.
module Main (main) where

import qualified Data.Set as Set
import Prelude (IO, error, fmap, return, show, (==))
import System.Directory (getDirectoryContents)

main :: IO ()
main = do
let expected = Set.fromList
[ "."
, ".."
, "main.hs"
]
actual <- fmap Set.fromList (getDirectoryContents "test")
if expected == actual
then return ()
else error (show (expected, actual))

0 comments on commit 95f12a7

Please sign in to comment.