yesod-bin 1.4.0.5 → 1.4.0.6
raw patch · 8 files changed
+301/−227 lines, 8 filesdep +transformers-compat
Dependencies added: transformers-compat
Files
- Options.hs +9/−8
- hsfiles/mongo.hsfiles +49/−37
- hsfiles/mysql.hsfiles +49/−37
- hsfiles/postgres-fay.hsfiles +49/−37
- hsfiles/postgres.hsfiles +49/−37
- hsfiles/simple.hsfiles +45/−33
- hsfiles/sqlite.hsfiles +49/−37
- yesod-bin.cabal +2/−1
Options.hs view
@@ -7,6 +7,8 @@ import Control.Applicative import qualified Control.Exception as E import Control.Monad+import Control.Monad.Trans.Except+import Control.Monad.Trans.Reader import Data.Char (isAlphaNum, isSpace, toLower) import Data.List (foldl') import Data.List.Split (splitOn)@@ -62,8 +64,6 @@ -- the map contains the paths with the value that's passed into the reader if the -- command line parser gives no result injectDefaultP :: M.Map [String] String -> [String] -> Parser a -> Parser a-injectDefaultP _ _ = id-{- FIXME Disabled due to changes in optparse-applicative 0.11 injectDefaultP _env _path n@(NilP{}) = n injectDefaultP env path p@(OptP o) | (Option (CmdReader cmds f) props) <- o =@@ -73,20 +73,21 @@ in parseri { infoParser = injectDefaultP env (path ++ [normalizeName cmd]) (infoParser parseri) } in OptP (Option (CmdReader cmds (`M.lookup` cmdMap)) props) | (Option (OptReader names (CReader _ rdr) _) _) <- o =- p <|> either' (const empty) pure (msum $ map (rdr <=< (maybe (left $ ErrorMsg "Missing environment variable") right . getEnvValue env path)) names)+ p <|> either (const empty)+ pure+ (runExcept . msum $+ map (maybe (throwE $ ErrorMsg "Missing environment variable")+ (runReaderT (unReadM rdr))+ . getEnvValue env path)+ names) | (Option (FlagReader names a) _) <- o = p <|> if any ((==Just "1") . getEnvValue env path) names then pure a else empty | otherwise = p- where- right= ReadM . Right- left = ReadM . Left- either' f g (ReadM x) = either f g x injectDefaultP env path (MultP p1 p2) = MultP (injectDefaultP env path p1) (injectDefaultP env path p2) injectDefaultP env path (AltP p1 p2) = AltP (injectDefaultP env path p1) (injectDefaultP env path p2) injectDefaultP _env _path b@(BindP {}) = b--} getEnvValue :: M.Map [String] String -> [String] -> OptName -> Maybe String getEnvValue env path (OptLong l) = M.lookup (path ++ [normalizeName l]) env
hsfiles/mongo.hsfiles view
@@ -279,7 +279,6 @@ -- https://github.com/yesodweb/yesod/wiki/Sending-email {-# START_FILE Handler/Home.hs #-}-{-# LANGUAGE TupleSections, OverloadedStrings #-} module Handler.Home where import Import@@ -415,6 +414,7 @@ NoMonomorphismRestriction DeriveDataTypeable ViewPatterns+ TupleSections build-depends: base >= 4 && < 5 , yesod >= 1.4.0 && < 1.5@@ -461,10 +461,26 @@ test-suite test type: exitcode-stdio-1.0- main-is: main.hs+ main-is: Spec.hs hs-source-dirs: test ghc-options: -Wall + extensions: TemplateHaskell+ QuasiQuotes+ OverloadedStrings+ NoImplicitPrelude+ CPP+ MultiParamTypeClasses+ TypeFamilies+ GADTs+ GeneralizedNewtypeDeriving+ FlexibleContexts+ EmptyDataDecls+ NoMonomorphismRestriction+ DeriveDataTypeable+ ViewPatterns+ TupleSections+ build-depends: base , PROJECTNAME , yesod-test >= 1.4 && < 1.5@@ -9002,7 +9018,7 @@ <form method=post action=@{HomeR}#form enctype=#{formEnctype}> ^{formWidget} <button .btn .btn-primary type="submit">- Send it! <span class="glyphicon glyphicon-upload">+ Send it! <span class="glyphicon glyphicon-upload"></span> <li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a # test suite that performs tests on this page. #@@ -9019,17 +9035,16 @@ color: #990 } -{-# START_FILE test/HomeTest.hs #-}-{-# LANGUAGE OverloadedStrings #-}-module HomeTest- ( homeSpecs+{-# START_FILE test/Handler/HomeSpec.hs #-}+module Handler.HomeSpec+ ( spec ) where import TestImport import qualified Data.List as L -homeSpecs :: Spec-homeSpecs =+spec :: Spec+spec = ydescribe "These are some example tests" $ do yit "loads the index and checks it looks right" $ do@@ -9041,11 +9056,11 @@ setMethod "POST" setUrl HomeR addNonce- fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference+ fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference byLabel "What's on the file?" "Some Content" statusIs 200- printBody+ -- more debugging printBody htmlCount ".message" 1 htmlAllContain ".message" "Some Content" htmlAllContain ".message" "text/plain"@@ -9059,13 +9074,34 @@ users <- runDB $ selectList ([] :: [Filter User]) [] assertEqual "user table empty" 0 $ L.length users +{-# START_FILE test/Spec.hs #-}+module Main where++import Import+import Yesod.Default.Config+import Yesod.Test+import Test.Hspec (hspec)+import Application (makeFoundation)++import qualified Handler.HomeSpec++main :: IO ()+main = do+ conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)+ { csParseExtra = parseExtra+ }+ foundation <- makeFoundation conf+ hspec $ do+ yesodSpec foundation $ do+ Handler.HomeSpec.spec+ {-# START_FILE test/TestImport.hs #-}-{-# LANGUAGE OverloadedStrings #-} module TestImport ( module Yesod.Test , module Model , module Foundation , module Database.Persist+ , module Prelude , runDB , Spec , Example@@ -9077,6 +9113,7 @@ import Control.Monad.Trans.Resource (ResourceT, runResourceT) import Control.Monad.Logger (NoLoggingT, runNoLoggingT) import Control.Monad.IO.Class (liftIO)+import Prelude import Foundation import Model@@ -9088,29 +9125,4 @@ runDB query = do pool <- fmap connPool getTestYesod liftIO $ runResourceT $ runNoLoggingT $ runMongoDBPoolDef query pool--{-# START_FILE test/main.hs #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--module Main where--import Import-import Yesod.Default.Config-import Yesod.Test-import Test.Hspec (hspec)-import Application (makeFoundation)--import HomeTest--main :: IO ()-main = do- conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)- { csParseExtra = parseExtra- }- foundation <- makeFoundation conf- hspec $ do- yesodSpec foundation $ do- homeSpecs
hsfiles/mysql.hsfiles view
@@ -292,7 +292,6 @@ -- https://github.com/yesodweb/yesod/wiki/Sending-email {-# START_FILE Handler/Home.hs #-}-{-# LANGUAGE TupleSections, OverloadedStrings #-} module Handler.Home where import Import@@ -425,6 +424,7 @@ NoMonomorphismRestriction DeriveDataTypeable ViewPatterns+ TupleSections build-depends: base >= 4 && < 5 , yesod >= 1.4.0 && < 1.5@@ -471,10 +471,26 @@ test-suite test type: exitcode-stdio-1.0- main-is: main.hs+ main-is: Spec.hs hs-source-dirs: test ghc-options: -Wall + extensions: TemplateHaskell+ QuasiQuotes+ OverloadedStrings+ NoImplicitPrelude+ CPP+ MultiParamTypeClasses+ TypeFamilies+ GADTs+ GeneralizedNewtypeDeriving+ FlexibleContexts+ EmptyDataDecls+ NoMonomorphismRestriction+ DeriveDataTypeable+ ViewPatterns+ TupleSections+ build-depends: base , PROJECTNAME , yesod-test >= 1.4 && < 1.5@@ -9021,7 +9037,7 @@ <form method=post action=@{HomeR}#form enctype=#{formEnctype}> ^{formWidget} <button .btn .btn-primary type="submit">- Send it! <span class="glyphicon glyphicon-upload">+ Send it! <span class="glyphicon glyphicon-upload"></span> <li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a # test suite that performs tests on this page. #@@ -9038,17 +9054,16 @@ color: #990 } -{-# START_FILE test/HomeTest.hs #-}-{-# LANGUAGE OverloadedStrings #-}-module HomeTest- ( homeSpecs+{-# START_FILE test/Handler/HomeSpec.hs #-}+module Handler.HomeSpec+ ( spec ) where import TestImport import qualified Data.List as L -homeSpecs :: Spec-homeSpecs =+spec :: Spec+spec = ydescribe "These are some example tests" $ do yit "loads the index and checks it looks right" $ do@@ -9060,11 +9075,11 @@ setMethod "POST" setUrl HomeR addNonce- fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference+ fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference byLabel "What's on the file?" "Some Content" statusIs 200- printBody+ -- more debugging printBody htmlCount ".message" 1 htmlAllContain ".message" "Some Content" htmlAllContain ".message" "text/plain"@@ -9078,13 +9093,34 @@ users <- runDB $ selectList ([] :: [Filter User]) [] assertEqual "user table empty" 0 $ L.length users +{-# START_FILE test/Spec.hs #-}+module Main where++import Import+import Yesod.Default.Config+import Yesod.Test+import Test.Hspec (hspec)+import Application (makeFoundation)++import qualified Handler.HomeSpec++main :: IO ()+main = do+ conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)+ { csParseExtra = parseExtra+ }+ foundation <- makeFoundation conf+ hspec $ do+ yesodSpec foundation $ do+ Handler.HomeSpec.spec+ {-# START_FILE test/TestImport.hs #-}-{-# LANGUAGE OverloadedStrings #-} module TestImport ( module Yesod.Test , module Model , module Foundation , module Database.Persist+ , module Prelude , runDB , Spec , Example@@ -9094,6 +9130,7 @@ import Database.Persist hiding (get) import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool) import Control.Monad.IO.Class (liftIO)+import Prelude import Foundation import Model@@ -9105,29 +9142,4 @@ runDB query = do pool <- fmap connPool getTestYesod liftIO $ runSqlPersistMPool query pool--{-# START_FILE test/main.hs #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--module Main where--import Import-import Yesod.Default.Config-import Yesod.Test-import Test.Hspec (hspec)-import Application (makeFoundation)--import HomeTest--main :: IO ()-main = do- conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)- { csParseExtra = parseExtra- }- foundation <- makeFoundation conf- hspec $ do- yesodSpec foundation $ do- homeSpecs
hsfiles/postgres-fay.hsfiles view
@@ -322,7 +322,6 @@ Nothing -> invalidArgs ["Invalid command"] {-# START_FILE Handler/Home.hs #-}-{-# LANGUAGE TupleSections, OverloadedStrings #-} module Handler.Home where import Import@@ -462,6 +461,7 @@ RankNTypes DeriveDataTypeable ViewPatterns+ TupleSections build-depends: base >= 4 && < 5 , yesod >= 1.4.0 && < 1.5@@ -509,10 +509,26 @@ test-suite test type: exitcode-stdio-1.0- main-is: main.hs+ main-is: Spec.hs hs-source-dirs: test ghc-options: -Wall + extensions: TemplateHaskell+ QuasiQuotes+ OverloadedStrings+ NoImplicitPrelude+ CPP+ MultiParamTypeClasses+ TypeFamilies+ GADTs+ GeneralizedNewtypeDeriving+ FlexibleContexts+ EmptyDataDecls+ NoMonomorphismRestriction+ DeriveDataTypeable+ ViewPatterns+ TupleSections+ build-depends: base , PROJECTNAME , yesod-test >= 1.4 && < 1.5@@ -9129,7 +9145,7 @@ <form method=post action=@{HomeR}#form enctype=#{formEnctype}> ^{formWidget} <button .btn .btn-primary type="submit">- Send it! <span class="glyphicon glyphicon-upload">+ Send it! <span class="glyphicon glyphicon-upload"></span> <li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a # test suite that performs tests on this page. #@@ -9151,17 +9167,16 @@ color: #990 } -{-# START_FILE test/HomeTest.hs #-}-{-# LANGUAGE OverloadedStrings #-}-module HomeTest- ( homeSpecs+{-# START_FILE test/Handler/HomeSpec.hs #-}+module Handler.HomeSpec+ ( spec ) where import TestImport import qualified Data.List as L -homeSpecs :: Spec-homeSpecs =+spec :: Spec+spec = ydescribe "These are some example tests" $ do yit "loads the index and checks it looks right" $ do@@ -9173,11 +9188,11 @@ setMethod "POST" setUrl HomeR addNonce- fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference+ fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference byLabel "What's on the file?" "Some Content" statusIs 200- printBody+ -- more debugging printBody htmlCount ".message" 1 htmlAllContain ".message" "Some Content" htmlAllContain ".message" "text/plain"@@ -9191,13 +9206,34 @@ users <- runDB $ selectList ([] :: [Filter User]) [] assertEqual "user table empty" 0 $ L.length users +{-# START_FILE test/Spec.hs #-}+module Main where++import Import+import Yesod.Default.Config+import Yesod.Test+import Test.Hspec (hspec)+import Application (makeFoundation)++import qualified Handler.HomeSpec++main :: IO ()+main = do+ conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)+ { csParseExtra = parseExtra+ }+ foundation <- makeFoundation conf+ hspec $ do+ yesodSpec foundation $ do+ Handler.HomeSpec.spec+ {-# START_FILE test/TestImport.hs #-}-{-# LANGUAGE OverloadedStrings #-} module TestImport ( module Yesod.Test , module Model , module Foundation , module Database.Persist+ , module Prelude , runDB , Spec , Example@@ -9207,6 +9243,7 @@ import Database.Persist hiding (get) import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool) import Control.Monad.IO.Class (liftIO)+import Prelude import Foundation import Model@@ -9218,29 +9255,4 @@ runDB query = do pool <- fmap connPool getTestYesod liftIO $ runSqlPersistMPool query pool--{-# START_FILE test/main.hs #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--module Main where--import Import-import Yesod.Default.Config-import Yesod.Test-import Test.Hspec (hspec)-import Application (makeFoundation)--import HomeTest--main :: IO ()-main = do- conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)- { csParseExtra = parseExtra- }- foundation <- makeFoundation conf- hspec $ do- yesodSpec foundation $ do- homeSpecs
hsfiles/postgres.hsfiles view
@@ -292,7 +292,6 @@ -- https://github.com/yesodweb/yesod/wiki/Sending-email {-# START_FILE Handler/Home.hs #-}-{-# LANGUAGE TupleSections, OverloadedStrings #-} module Handler.Home where import Import@@ -425,6 +424,7 @@ NoMonomorphismRestriction DeriveDataTypeable ViewPatterns+ TupleSections build-depends: base >= 4 && < 5 , yesod >= 1.4.0 && < 1.5@@ -471,10 +471,26 @@ test-suite test type: exitcode-stdio-1.0- main-is: main.hs+ main-is: Spec.hs hs-source-dirs: test ghc-options: -Wall + extensions: TemplateHaskell+ QuasiQuotes+ OverloadedStrings+ NoImplicitPrelude+ CPP+ MultiParamTypeClasses+ TypeFamilies+ GADTs+ GeneralizedNewtypeDeriving+ FlexibleContexts+ EmptyDataDecls+ NoMonomorphismRestriction+ DeriveDataTypeable+ ViewPatterns+ TupleSections+ build-depends: base , PROJECTNAME , yesod-test >= 1.4 && < 1.5@@ -9021,7 +9037,7 @@ <form method=post action=@{HomeR}#form enctype=#{formEnctype}> ^{formWidget} <button .btn .btn-primary type="submit">- Send it! <span class="glyphicon glyphicon-upload">+ Send it! <span class="glyphicon glyphicon-upload"></span> <li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a # test suite that performs tests on this page. #@@ -9038,17 +9054,16 @@ color: #990 } -{-# START_FILE test/HomeTest.hs #-}-{-# LANGUAGE OverloadedStrings #-}-module HomeTest- ( homeSpecs+{-# START_FILE test/Handler/HomeSpec.hs #-}+module Handler.HomeSpec+ ( spec ) where import TestImport import qualified Data.List as L -homeSpecs :: Spec-homeSpecs =+spec :: Spec+spec = ydescribe "These are some example tests" $ do yit "loads the index and checks it looks right" $ do@@ -9060,11 +9075,11 @@ setMethod "POST" setUrl HomeR addNonce- fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference+ fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference byLabel "What's on the file?" "Some Content" statusIs 200- printBody+ -- more debugging printBody htmlCount ".message" 1 htmlAllContain ".message" "Some Content" htmlAllContain ".message" "text/plain"@@ -9078,13 +9093,34 @@ users <- runDB $ selectList ([] :: [Filter User]) [] assertEqual "user table empty" 0 $ L.length users +{-# START_FILE test/Spec.hs #-}+module Main where++import Import+import Yesod.Default.Config+import Yesod.Test+import Test.Hspec (hspec)+import Application (makeFoundation)++import qualified Handler.HomeSpec++main :: IO ()+main = do+ conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)+ { csParseExtra = parseExtra+ }+ foundation <- makeFoundation conf+ hspec $ do+ yesodSpec foundation $ do+ Handler.HomeSpec.spec+ {-# START_FILE test/TestImport.hs #-}-{-# LANGUAGE OverloadedStrings #-} module TestImport ( module Yesod.Test , module Model , module Foundation , module Database.Persist+ , module Prelude , runDB , Spec , Example@@ -9094,6 +9130,7 @@ import Database.Persist hiding (get) import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool) import Control.Monad.IO.Class (liftIO)+import Prelude import Foundation import Model@@ -9105,29 +9142,4 @@ runDB query = do pool <- fmap connPool getTestYesod liftIO $ runSqlPersistMPool query pool--{-# START_FILE test/main.hs #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--module Main where--import Import-import Yesod.Default.Config-import Yesod.Test-import Test.Hspec (hspec)-import Application (makeFoundation)--import HomeTest--main :: IO ()-main = do- conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)- { csParseExtra = parseExtra- }- foundation <- makeFoundation conf- hspec $ do- yesodSpec foundation $ do- homeSpecs
hsfiles/simple.hsfiles view
@@ -229,7 +229,6 @@ -- https://github.com/yesodweb/yesod/wiki/Sending-email {-# START_FILE Handler/Home.hs #-}-{-# LANGUAGE TupleSections, OverloadedStrings #-} module Handler.Home where import Import@@ -344,6 +343,7 @@ NoMonomorphismRestriction DeriveDataTypeable ViewPatterns+ TupleSections build-depends: base >= 4 && < 5 , yesod >= 1.4.0 && < 1.5@@ -387,10 +387,26 @@ test-suite test type: exitcode-stdio-1.0- main-is: main.hs+ main-is: Spec.hs hs-source-dirs: test ghc-options: -Wall + extensions: TemplateHaskell+ QuasiQuotes+ OverloadedStrings+ NoImplicitPrelude+ CPP+ MultiParamTypeClasses+ TypeFamilies+ GADTs+ GeneralizedNewtypeDeriving+ FlexibleContexts+ EmptyDataDecls+ NoMonomorphismRestriction+ DeriveDataTypeable+ ViewPatterns+ TupleSections+ build-depends: base , PROJECTNAME , yesod-test >= 1.4 && < 1.5@@ -8878,7 +8894,7 @@ <form method=post action=@{HomeR}#form enctype=#{formEnctype}> ^{formWidget} <button .btn .btn-primary type="submit">- Send it! <span class="glyphicon glyphicon-upload">+ Send it! <span class="glyphicon glyphicon-upload"></span> <li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a # test suite that performs tests on this page. #@@ -8895,16 +8911,15 @@ color: #990 } -{-# START_FILE test/HomeTest.hs #-}-{-# LANGUAGE OverloadedStrings #-}-module HomeTest- ( homeSpecs+{-# START_FILE test/Handler/HomeSpec.hs #-}+module Handler.HomeSpec+ ( spec ) where import TestImport -homeSpecs :: Spec-homeSpecs =+spec :: Spec+spec = ydescribe "These are some example tests" $ do yit "loads the index and checks it looks right" $ do@@ -8916,35 +8931,16 @@ setMethod "POST" setUrl HomeR addNonce- fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference+ fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference byLabel "What's on the file?" "Some Content" statusIs 200- printBody+ -- more debugging printBody htmlCount ".message" 1 htmlAllContain ".message" "Some Content" htmlAllContain ".message" "text/plain" -{-# START_FILE test/TestImport.hs #-}-{-# LANGUAGE OverloadedStrings #-}-module TestImport- ( module Yesod.Test- , module Foundation- , Spec- , Example- ) where--import Yesod.Test-import Foundation--type Spec = YesodSpec App-type Example = YesodExample App--{-# START_FILE test/main.hs #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-+{-# START_FILE test/Spec.hs #-} module Main where import Import@@ -8953,7 +8949,7 @@ import Test.Hspec (hspec) import Application (makeFoundation) -import HomeTest+import qualified Handler.HomeSpec main :: IO () main = do@@ -8963,5 +8959,21 @@ foundation <- makeFoundation conf hspec $ do yesodSpec foundation $ do- homeSpecs+ Handler.HomeSpec.spec++{-# START_FILE test/TestImport.hs #-}+module TestImport+ ( module Yesod.Test+ , module Foundation+ , module Prelude+ , Spec+ , Example+ ) where++import Yesod.Test+import Prelude+import Foundation++type Spec = YesodSpec App+type Example = YesodExample App
hsfiles/sqlite.hsfiles view
@@ -292,7 +292,6 @@ -- https://github.com/yesodweb/yesod/wiki/Sending-email {-# START_FILE Handler/Home.hs #-}-{-# LANGUAGE TupleSections, OverloadedStrings #-} module Handler.Home where import Import@@ -425,6 +424,7 @@ NoMonomorphismRestriction DeriveDataTypeable ViewPatterns+ TupleSections build-depends: base >= 4 && < 5 , yesod >= 1.4.0 && < 1.5@@ -471,10 +471,26 @@ test-suite test type: exitcode-stdio-1.0- main-is: main.hs+ main-is: Spec.hs hs-source-dirs: test ghc-options: -Wall + extensions: TemplateHaskell+ QuasiQuotes+ OverloadedStrings+ NoImplicitPrelude+ CPP+ MultiParamTypeClasses+ TypeFamilies+ GADTs+ GeneralizedNewtypeDeriving+ FlexibleContexts+ EmptyDataDecls+ NoMonomorphismRestriction+ DeriveDataTypeable+ ViewPatterns+ TupleSections+ build-depends: base , PROJECTNAME , yesod-test >= 1.4 && < 1.5@@ -9008,7 +9024,7 @@ <form method=post action=@{HomeR}#form enctype=#{formEnctype}> ^{formWidget} <button .btn .btn-primary type="submit">- Send it! <span class="glyphicon glyphicon-upload">+ Send it! <span class="glyphicon glyphicon-upload"></span> <li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a # test suite that performs tests on this page. #@@ -9025,17 +9041,16 @@ color: #990 } -{-# START_FILE test/HomeTest.hs #-}-{-# LANGUAGE OverloadedStrings #-}-module HomeTest- ( homeSpecs+{-# START_FILE test/Handler/HomeSpec.hs #-}+module Handler.HomeSpec+ ( spec ) where import TestImport import qualified Data.List as L -homeSpecs :: Spec-homeSpecs =+spec :: Spec+spec = ydescribe "These are some example tests" $ do yit "loads the index and checks it looks right" $ do@@ -9047,11 +9062,11 @@ setMethod "POST" setUrl HomeR addNonce- fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference+ fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference byLabel "What's on the file?" "Some Content" statusIs 200- printBody+ -- more debugging printBody htmlCount ".message" 1 htmlAllContain ".message" "Some Content" htmlAllContain ".message" "text/plain"@@ -9065,13 +9080,34 @@ users <- runDB $ selectList ([] :: [Filter User]) [] assertEqual "user table empty" 0 $ L.length users +{-# START_FILE test/Spec.hs #-}+module Main where++import Import+import Yesod.Default.Config+import Yesod.Test+import Test.Hspec (hspec)+import Application (makeFoundation)++import qualified Handler.HomeSpec++main :: IO ()+main = do+ conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)+ { csParseExtra = parseExtra+ }+ foundation <- makeFoundation conf+ hspec $ do+ yesodSpec foundation $ do+ Handler.HomeSpec.spec+ {-# START_FILE test/TestImport.hs #-}-{-# LANGUAGE OverloadedStrings #-} module TestImport ( module Yesod.Test , module Model , module Foundation , module Database.Persist+ , module Prelude , runDB , Spec , Example@@ -9081,6 +9117,7 @@ import Database.Persist hiding (get) import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool) import Control.Monad.IO.Class (liftIO)+import Prelude import Foundation import Model@@ -9092,29 +9129,4 @@ runDB query = do pool <- fmap connPool getTestYesod liftIO $ runSqlPersistMPool query pool--{-# START_FILE test/main.hs #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--module Main where--import Import-import Yesod.Default.Config-import Yesod.Test-import Test.Hspec (hspec)-import Application (makeFoundation)--import HomeTest--main :: IO ()-main = do- conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)- { csParseExtra = parseExtra- }- foundation <- makeFoundation conf- hspec $ do- yesodSpec foundation $ do- homeSpecs
yesod-bin.cabal view
@@ -1,5 +1,5 @@ name: yesod-bin-version: 1.4.0.5+version: 1.4.0.6 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -84,6 +84,7 @@ , http-conduit >= 2.1.4 , project-template >= 0.1.1 , transformers+ , transformers-compat , warp >= 1.3.7.5 , wai >= 1.4 , wai-extra