[commit: packages/directory] improve-tests, improve-tests-for-real, master, tmp: Add fledgeling test suite (e5ab065)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:37:03 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branches: improve-tests,improve-tests-for-real,master,tmp
Link       : http://ghc.haskell.org/trac/ghc/changeset/e5ab0653643c18ec6106be1674179ae94c66e858/directory

>---------------------------------------------------------------

commit e5ab0653643c18ec6106be1674179ae94c66e858
Author: Michael Snoyman <michael at snoyman.com>
Date:   Tue Feb 17 11:29:58 2015 +0200

    Add fledgeling test suite
    
    We should really get this to run all of the tests in the tests directory
    instead.


>---------------------------------------------------------------

e5ab0653643c18ec6106be1674179ae94c66e858
 .travis.yml     |  3 ++-
 directory.cabal |  9 +++++++++
 test/main.hs    | 20 ++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index ea01c3c..05ed4e4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,10 +25,11 @@ install:
 
 script:
  - autoreconf -i
- - cabal configure -v2
+ - cabal configure -v2 --enable-tests
  - 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/;
diff --git a/directory.cabal b/directory.cabal
index 32f22a1..83e4109 100644
--- a/directory.cabal
+++ b/directory.cabal
@@ -61,3 +61,12 @@ Library
         build-depends: unix >= 2.5.1 && < 2.8
 
     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
diff --git a/test/main.hs b/test/main.hs
new file mode 100644
index 0000000..7a9fcb3
--- /dev/null
+++ b/test/main.hs
@@ -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))



More information about the ghc-commits mailing list