Permalink
Browse files

testFormatLogTime should not depend on being GMT-0500!!!

  • Loading branch information...
1 parent 440456a commit 0ee8437381a52f234b3ed4dcb247c8d8d63992be @gregorycollins gregorycollins committed Aug 15, 2010
Showing with 12 additions and 4 deletions.
  1. +3 −0 test/runTestsAndCoverage.sh
  2. +2 −1 test/snap-core-testsuite.cabal
  3. +7 −3 test/suite/Snap/Internal/Http/Types/Tests.hs
@@ -4,6 +4,9 @@ set -e
SUITE=./dist/build/testsuite/testsuite
+export LC_ALL=C
+export LANG=C
+
rm -f testsuite.tix
if [ ! -f $SUITE ]; then
@@ -10,7 +10,7 @@ Flag debug
Flag testsuite
Description: Are we running the testsuite? Causes arguments to \"debug\" to
be evaluated but not printed.
- Default: False
+ Default: True
Flag portable
Description: Compile in cross-platform mode. No platform-specific code or
@@ -54,6 +54,7 @@ Executable testsuite
old-locale,
old-time,
parallel >= 2.2 && <2.3,
+ regex-posix >= 0.94.4 && <0.95,
test-framework >= 0.3.1 && <0.4,
test-framework-hunit >= 0.2.5 && < 0.3,
test-framework-quickcheck2 >= 0.2.6 && < 0.3,
@@ -5,7 +5,7 @@ module Snap.Internal.Http.Types.Tests
import Control.Monad
import Control.Parallel.Strategies
-import Data.ByteString.Char8 ()
+import Data.ByteString.Char8 (ByteString)
import Data.ByteString.Lazy.Char8 ()
import Data.IORef
import Data.Iteratee (stream2stream, run)
@@ -17,7 +17,7 @@ import Prelude hiding (take)
import Test.Framework
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test, path)
-
+import Text.Regex.Posix
import Snap.Internal.Http.Types
import Snap.Iteratee (enumBS, fromWrap)
@@ -39,7 +39,11 @@ mkRq = do
testFormatLogTime :: Test
testFormatLogTime = testCase "formatLogTime" $ do
b <- formatLogTime 3804938
- assertEqual "formatLogTime" "13/Feb/1970:19:55:38 -0500" b
+
+ let re = ("^[0-9]{1,2}/[A-Za-z]{3}/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2} -[0-9]{4}$"
+ :: ByteString)
+
+ assertBool "formatLogTime" $ b =~ re
testAddHeader :: Test

0 comments on commit 0ee8437

Please sign in to comment.