Yesod.Internal.TestApi exports internals for tests

This commit is contained in:
Björn Buckwalter 2011-09-17 00:06:31 +08:00
parent f925fa28ec
commit 4ed740724e
4 changed files with 17 additions and 5 deletions

View File

@ -5,10 +5,9 @@ module Yesod.Internal.Request
, Request (..)
, RequestBodyContents
, FileInfo (..)
#ifdef TEST
-- The below are exported for testing.
, randomString
, parseWaiRequest'
#endif
) where
import Control.Applicative ((<$>))
@ -41,8 +40,7 @@ parseWaiRequest :: W.Request
-> [(Text, Text)] -- ^ session
-> Maybe a
-> IO Request
parseWaiRequest env session' key' = parseWaiRequest' env session' key'
<$> newStdGen
parseWaiRequest env session' key' = parseWaiRequest' env session' key' <$> newStdGen
parseWaiRequest' :: RandomGen g
=> W.Request

View File

@ -0,0 +1,10 @@
--
-- | WARNING: This module exposes internal interfaces solely for the
-- purpose of facilitating unit testing with cabal install. Library
-- users should not import this module.
--
module Yesod.Internal.TestApi
( Request (..), randomString, parseWaiRequest'
) where
import Yesod.Internal.Request (Request (..), randomString, parseWaiRequest')

View File

@ -6,13 +6,15 @@ import Test.Widget
import Test.Media
import Test.Links
import Test.NoOverloadedStrings
import Test.InternalRequest
main :: IO ()
main = hspecX $ descriptions $
main = hspecX $ descriptions $
[ cleanPathTest
, exceptionsTest
, widgetTest
, mediaTest
, linksTest
, noOverloadedTest
, internalRequestTest
]

View File

@ -65,6 +65,7 @@ library
Yesod.Request
Yesod.Widget
Yesod.Message
Yesod.Internal.TestApi
other-modules: Yesod.Internal
Yesod.Internal.Core
Yesod.Internal.Session
@ -101,6 +102,7 @@ test-suite runtests
,shakespeare-js
,text
,http-types
, random
,HUnit
,QuickCheck >= 2 && < 3
ghc-options: -Wall