get yesod-static tests running again

This commit is contained in:
Greg Weber 2011-11-27 08:10:35 -06:00
parent 9737ad70da
commit 11ac3a00dd
36 changed files with 52 additions and 31 deletions

View File

@ -104,7 +104,7 @@ Installing a mega repo helps cabal align all the dependencies correctly.
cd hamlet
# build and test the mega repo
cabal install --enable-tests
cabal configure -ftest --enable-tests
cabal build
cabal test
~~~
@ -121,7 +121,7 @@ If you first install the mega repo, then it should be easier to work on an indiv
cd shakespeare-text
# build and test the individual package
cabal configure --enable-tests
cabal configure -ftest --enable-tests
cabal build
cabal test
~~~

View File

@ -1 +1 @@
yesod-core/en.msg
../yesod-core/test/en.msg

1
test/fs Symbolic link
View File

@ -0,0 +1 @@
../yesod-static/test/fs

View File

@ -1,5 +1,9 @@
import Test.Hspec
import qualified YesodCoreTest
import qualified YesodStaticTest
main :: IO ()
main = hspecX $ descriptions $ YesodCoreTest.specs
main = hspecX $ descriptions [
concat YesodCoreTest.specs
, concat YesodStaticTest.specs
]

View File

@ -1 +0,0 @@
../yesod-core/test

View File

@ -12,7 +12,7 @@ import YesodCoreTest.ErrorHandling
import Test.Hspec
specs :: [Specs]
specs = -- concat
specs =
[ cleanPathTest
, exceptionsTest
, widgetTest

View File

@ -90,8 +90,6 @@ library
Yesod.Internal.RouteParsing
Paths_yesod_core
ghc-options: -Wall
if flag(test)
Buildable: False
test-suite tests
type: exitcode-stdio-1.0

View File

@ -20,6 +20,10 @@ flag threaded
default: True
description: Build with support for multithreaded execution
flag test
description: Build for use with running tests
default: False
library
hs-source-dirs: yesod, yesod-auth, yesod-core, yesod-default, yesod-examples, yesod-form, yesod-json, yesod-newsfeed, yesod-persistent, yesod-sitemap, yesod-static
@ -115,6 +119,9 @@ library
if !os(windows)
build-depends: unix
if flag(test)
cpp-options: -DTEST
build-depends:
-- yesod
Cabal >= 1.8 && < 1.13
@ -158,7 +165,7 @@ library
, warp >= 0.4 && < 0.5
, wai >= 0.4 && < 0.5
, wai-extra >= 0.4.1 && < 0.5
, time >= 1.1.4 && < 1.3
, time >= 1.1.4
, bytestring >= 0.9.1.4 && < 0.12
, text >= 0.9 && < 0.12
, template-haskell
@ -193,6 +200,7 @@ test-suite tests
hs-source-dirs:
test
yesod-core/test
yesod-static/test
if flag(ghc7)
type: exitcode-stdio-1.0

View File

@ -33,6 +33,9 @@ module Yesod.Static
, publicFiles
-- * Hashing
, base64md5
#ifdef TEST
, getFileListPieces
#endif
) where
import Prelude hiding (FilePath)

View File

@ -0,0 +1,16 @@
module YesodStaticTest (specs) where
import Test.Hspec
import Test.HUnit ( (@?=) )
import Test.Hspec.HUnit ( )
import Yesod.Static (getFileListPieces)
specs :: [Specs]
specs = [
describe "get file list" [
it "pieces" $ do
x <- getFileListPieces "test/fs"
x @?= [["foo"], ["bar", "baz"]]
]
]

View File

Before

Width:  |  Height:  |  Size: 891 B

After

Width:  |  Height:  |  Size: 891 B

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 683 B

7
yesod-static/tests.hs Normal file
View File

@ -0,0 +1,7 @@
{-# LANGUAGE OverloadedStrings #-}
import Test.Hspec
import YesodStaticTest (specs)
main :: IO ()
main = hspecX $ descriptions specs

View File

@ -1,17 +0,0 @@
{-# LANGUAGE OverloadedStrings #-}
import Yesod.Static ()
import Test.Hspec
import Test.Hspec.HUnit ()
-- import Test.Hspec.QuickCheck (prop)
main :: IO ()
main = return () -- hspecX $ return []
{- FIXME specs
specs :: IO [Spec]
specs = runSpecM $ do
context "get file list" $ do
ti "pieces" $ do
x <- getFileListPieces "tests/data"
x @?= [["foo"], ["bar", "baz"]]-}

View File

@ -15,10 +15,13 @@ extra-source-files:
tests/runtests.hs
flag test
description: Build the executable to run unit tests
description: Build for use with running tests
default: False
library
if flag(test)
cpp-options: -DTEST
build-depends: base >= 4 && < 5
, containers >= 0.2 && < 0.5
, old-time >= 1.0
@ -40,9 +43,9 @@ library
exposed-modules: Yesod.Static
ghc-options: -Wall
test-suite runtests
hs-source-dirs: tests
main-is: runtests.hs
test-suite tests
hs-source-dirs: test
main-is: ../tests.hs
type: exitcode-stdio-1.0
cpp-options: -DTEST
build-depends: yesod-static
@ -50,7 +53,6 @@ test-suite runtests
, hspec >= 0.8 && < 0.10
, HUnit
ghc-options: -Wall
main-is: runtests.hs
source-repository head
type: git