Minor cleanup
This commit is contained in:
parent
c3fc8a218a
commit
7d132bf779
@ -20,7 +20,7 @@ instance Arbitrary File where
|
|||||||
arbitrary = do
|
arbitrary = do
|
||||||
fileTitle <- (joinPath <$> arbitrary) `suchThat` (any $ not . isPathSeparator)
|
fileTitle <- (joinPath <$> arbitrary) `suchThat` (any $ not . isPathSeparator)
|
||||||
date <- addDays <$> arbitrary <*> pure (fromGregorian 2043 7 2)
|
date <- addDays <$> arbitrary <*> pure (fromGregorian 2043 7 2)
|
||||||
fileModified <- addUTCTime <$> arbitrary <*> pure (UTCTime date 0)
|
fileModified <- (addUTCTime <$> arbitrary <*> pure (UTCTime date 0)) `suchThat` inZipRange
|
||||||
fileContent <- arbitrary
|
fileContent <- arbitrary
|
||||||
return File{..}
|
return File{..}
|
||||||
shrink = genericShrink
|
shrink = genericShrink
|
||||||
@ -35,8 +35,7 @@ spec = describe "Zip file handling" $ do
|
|||||||
= makeValid . dropWhile isPathSeparator . bool (dropWhileEnd isPathSeparator) addTrailingPathSeparator (isNothing $ fileContent file) . normalise . makeValid
|
= makeValid . dropWhile isPathSeparator . bool (dropWhileEnd isPathSeparator) addTrailingPathSeparator (isNothing $ fileContent file) . normalise . makeValid
|
||||||
acceptableTimeDifference t1 t2 = abs (diffUTCTime t1 t2) <= 2
|
acceptableTimeDifference t1 t2 = abs (diffUTCTime t1 t2) <= 2
|
||||||
(shouldBe `on` acceptableFilenameChanges) (fileTitle file') (fileTitle file)
|
(shouldBe `on` acceptableFilenameChanges) (fileTitle file') (fileTitle file)
|
||||||
when (inZipRange $ fileModified file) $
|
(fileModified file', fileModified file) `shouldSatisfy` uncurry acceptableTimeDifference
|
||||||
(fileModified file', fileModified file) `shouldSatisfy` uncurry acceptableTimeDifference
|
|
||||||
(fileContent file') `shouldBe` (fileContent file)
|
(fileContent file') `shouldBe` (fileContent file)
|
||||||
|
|
||||||
inZipRange :: UTCTime -> Bool
|
inZipRange :: UTCTime -> Bool
|
||||||
|
|||||||
Reference in New Issue
Block a user