Fix build with QuickCheck 2.10.

QuickCheck added an Arbitrary instance for CTime aka EpochTime. However,
while git-annex's instance disallowed times before the epoch, QuickCheck's
does not. So, rather than using its instance, convert from an Integer.

This commit was sponsored by Thomas Hochstein on Patreon.
This commit is contained in:
Joey Hess 2017-06-17 13:04:48 -04:00
parent 27f7c8d09a
commit 75cecbbe3f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,9 @@
git-annex (6.20170521) UNRELEASED; urgency=medium
* Fix build with QuickCheck 2.10.
-- Joey Hess <id@joeyh.name> Sat, 17 Jun 2017 13:02:24 -0400
git-annex (6.20170520) unstable; urgency=medium git-annex (6.20170520) unstable; urgency=medium
* move --to=here moves from all reachable remotes to the local repository. * move --to=here moves from all reachable remotes to the local repository.

2
Key.hs
View file

@ -147,7 +147,7 @@ instance Arbitrary Key where
<$> (listOf1 $ elements $ ['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "-_\r\n \t") <$> (listOf1 $ elements $ ['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "-_\r\n \t")
<*> (parseKeyVariety <$> (listOf1 $ elements ['A'..'Z'])) -- BACKEND <*> (parseKeyVariety <$> (listOf1 $ elements ['A'..'Z'])) -- BACKEND
<*> ((abs <$>) <$> arbitrary) -- size cannot be negative <*> ((abs <$>) <$> arbitrary) -- size cannot be negative
<*> arbitrary <*> ((abs . fromInteger <$>) <$> arbitrary) -- mtime cannot be negative
<*> ((abs <$>) <$> arbitrary) -- chunksize cannot be negative <*> ((abs <$>) <$> arbitrary) -- chunksize cannot be negative
<*> ((succ . abs <$>) <$> arbitrary) -- chunknum cannot be 0 or negative <*> ((succ . abs <$>) <$> arbitrary) -- chunknum cannot be 0 or negative

View file

@ -210,7 +210,8 @@ instance Arbitrary InodeCache where
let prim = InodeCachePrim let prim = InodeCachePrim
<$> arbitrary <$> arbitrary
<*> arbitrary <*> arbitrary
<*> arbitrary -- timestamp cannot be negative
<*> (abs . fromInteger <$> arbitrary)
in InodeCache <$> prim in InodeCache <$> prim
#ifdef mingw32_HOST_OS #ifdef mingw32_HOST_OS

View file

@ -35,9 +35,6 @@ instance (Arbitrary v, Ord v) => Arbitrary (S.Set v) where
instance Arbitrary POSIXTime where instance Arbitrary POSIXTime where
arbitrary = fromInteger <$> nonNegative arbitrarySizedIntegral arbitrary = fromInteger <$> nonNegative arbitrarySizedIntegral
instance Arbitrary EpochTime where
arbitrary = fromInteger <$> nonNegative arbitrarySizedIntegral
{- Pids are never negative, or 0. -} {- Pids are never negative, or 0. -}
instance Arbitrary ProcessID where instance Arbitrary ProcessID where
arbitrary = arbitrarySizedBoundedIntegral `suchThat` (> 0) arbitrary = arbitrarySizedBoundedIntegral `suchThat` (> 0)