mighttpd2 2.8.3 → 2.8.4
raw patch · 6 files changed
+43/−46 lines, 6 filesdep +hspecdep −HUnitdep −test-framework-hunitdep −test-framework-th-prime
Dependencies added: hspec
Dependencies removed: HUnit, test-framework-hunit, test-framework-th-prime, unix-bytestring
Files
- FileCache.hs +4/−4
- mighttpd2.cabal +7/−9
- test/ConfigSpec.hs +14/−0
- test/RouteSpec.hs +17/−0
- test/Spec.hs +1/−0
- test/Test.hs +0/−33
FileCache.hs view
@@ -41,10 +41,10 @@ where info = FileInfo { fileInfoName = path- , fileInfoSize = size fs- , fileInfoTime = time- , fileInfoDate = formatHTTPDate time- }+ , fileInfoSize = size fs+ , fileInfoTime = time+ , fileInfoDate = formatHTTPDate time+ } size = fromIntegral . fileSize time = epochTimeToHTTPDate (modificationTime fs) entry = Positive info
mighttpd2.cabal view
@@ -1,5 +1,5 @@ Name: mighttpd2-Version: 2.8.3+Version: 2.8.4 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3@@ -17,7 +17,7 @@ Executable mighty Main-Is: Mighty.hs- GHC-Options: -Wall -threaded+ GHC-Options: -Wall -threaded -rtsopts Build-Depends: base >= 4.0 && < 5 -- should be removed someday , blaze-html >= 0.5@@ -39,7 +39,6 @@ , time , transformers , unix- , unix-bytestring , unix-time , unordered-containers , wai >= 1.3@@ -81,10 +80,12 @@ , process-conduit , unix -Test-Suite test- Main-Is: Test.hs+Test-Suite spec+ Main-Is: Spec.hs Hs-Source-Dirs: test, . Type: exitcode-stdio-1.0+ Other-Modules: ConfigSpec+ RouteSpec Build-Depends: base >= 4 && < 5 , bytestring , deepseq@@ -100,16 +101,13 @@ , time , transformers , unix- , unix-bytestring , unordered-containers , wai >= 1.1 , wai-app-file-cgi , wai-logger , wai-logger-prefork , warp- , HUnit- , test-framework-hunit- , test-framework-th-prime+ , hspec >= 1.3 Source-Repository head Type: git
+ test/ConfigSpec.hs view
@@ -0,0 +1,14 @@+module ConfigSpec where++import Config.Internal+import Test.Hspec++spec :: Spec+spec = do+ describe "parseConfig" $ do+ it "parses example.conf correctly" $ do+ res <- parseConfig "example.conf"+ res `shouldBe` ans++ans :: [(String, ConfValue)]+ans = [("Port",CV_Int 80),("Debug_Mode",CV_Bool True),("User",CV_String "root"),("Group",CV_String "root"),("Pid_File",CV_String "/var/run/mighty.pid"),("Logging",CV_Bool True),("Log_File",CV_String "/var/log/mighty"),("Log_File_Size",CV_Int 16777216),("Log_Backup_Number",CV_Int 10),("Index_File",CV_String "index.html"),("Index_Cgi",CV_String "index.cgi"),("Status_File_Dir",CV_String "/usr/local/share/mighty/status"),("Connection_Timeout",CV_Int 30),("Fd_Cache_Duration",CV_Int 10),("Worker_Processes",CV_Int 1)]
+ test/RouteSpec.hs view
@@ -0,0 +1,17 @@+{-# LANGUAGE OverloadedStrings #-}++module RouteSpec where++import Route+import Test.Hspec+import Types++spec :: Spec+spec = do+ describe "parseRoute" $ do+ it "parses example.route correctly" $ do+ res <- parseRoute "example.route"+ res `shouldBe` ans++ans :: [Block]+ans = [Block ["localhost","www.example.com"] [RouteCGI "/~alice/cgi-bin/" "/home/alice/public_html/cgi-bin/",RouteFile "/~alice/" "/home/alice/public_html/",RouteCGI "/cgi-bin/" "/export/cgi-bin/",RouteRevProxy "/app/cal/" "/calendar/" "example.net" 80,RouteRevProxy "/app/wiki/" "/" "127.0.0.1" 3000,RouteFile "/" "/export/www/"]]
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
− test/Test.hs
@@ -1,33 +0,0 @@-{-# LANGUAGE OverloadedStrings, TemplateHaskell #-}--module Main where--import Config.Internal-import Route-import Test.Framework.Providers.HUnit-import Test.Framework.TH.Prime-import Test.HUnit-import Types--------------------------------------------------------------------main :: IO ()-main = $(defaultMainGenerator)--------------------------------------------------------------------case_config :: Assertion-case_config = do- res <- parseConfig "example.conf"- res @?= ans- where- ans = [("Port",CV_Int 80),("Debug_Mode",CV_Bool True),("User",CV_String "root"),("Group",CV_String "root"),("Pid_File",CV_String "/var/run/mighty.pid"),("Logging",CV_Bool True),("Log_File",CV_String "/var/log/mighty"),("Log_File_Size",CV_Int 16777216),("Log_Backup_Number",CV_Int 10),("Index_File",CV_String "index.html"),("Index_Cgi",CV_String "index.cgi"),("Status_File_Dir",CV_String "/usr/local/share/mighty/status"),("Connection_Timeout",CV_Int 30),("Worker_Processes",CV_Int 1)]--case_route :: Assertion-case_route = do- res <- parseRoute "example.route"- res @?= ans- where- ans = [Block ["localhost","www.example.com"] [RouteCGI "/~alice/cgi-bin/" "/home/alice/public_html/cgi-bin/",RouteFile "/~alice/" "/home/alice/public_html/",RouteCGI "/cgi-bin/" "/export/cgi-bin/",RouteRevProxy "/app/cal/" "/calendar/" "example.net" 80,RouteRevProxy "/app/wiki/" "/" "127.0.0.1" 3000,RouteFile "/" "/export/www/"]]------------------------------------------------------------------