move Arbitrary instance to new Types.Transfer module
Avoid orphan instance warning
This commit is contained in:
parent
d17f08afdc
commit
c9082cf0e4
2 changed files with 11 additions and 13 deletions
|
@ -5,7 +5,6 @@
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
module Logs.Transfer where
|
module Logs.Transfer where
|
||||||
|
@ -16,7 +15,6 @@ import Annex.Perms
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
import Utility.Percentage
|
import Utility.Percentage
|
||||||
import Utility.QuickCheck
|
|
||||||
import Utility.PID
|
import Utility.PID
|
||||||
import Annex.LockPool
|
import Annex.LockPool
|
||||||
import Logs.TimeStamp
|
import Logs.TimeStamp
|
||||||
|
@ -292,17 +290,6 @@ failedTransferDir u direction r = gitAnnexTransferDir r
|
||||||
</> showLcDirection direction
|
</> showLcDirection direction
|
||||||
</> filter (/= '/') (fromUUID u)
|
</> filter (/= '/') (fromUUID u)
|
||||||
|
|
||||||
instance Arbitrary TransferInfo where
|
|
||||||
arbitrary = TransferInfo
|
|
||||||
<$> arbitrary
|
|
||||||
<*> arbitrary
|
|
||||||
<*> pure Nothing -- cannot generate a ThreadID
|
|
||||||
<*> pure Nothing -- remote not needed
|
|
||||||
<*> arbitrary
|
|
||||||
-- associated file cannot be empty (but can be Nothing)
|
|
||||||
<*> arbitrary `suchThat` (/= Just "")
|
|
||||||
<*> arbitrary
|
|
||||||
|
|
||||||
prop_read_write_transferinfo :: TransferInfo -> Bool
|
prop_read_write_transferinfo :: TransferInfo -> Bool
|
||||||
prop_read_write_transferinfo info
|
prop_read_write_transferinfo info
|
||||||
| isJust (transferRemote info) = True -- remote not stored
|
| isJust (transferRemote info) = True -- remote not stored
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Types.Transfer where
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import Utility.PID
|
import Utility.PID
|
||||||
|
import Utility.QuickCheck
|
||||||
|
|
||||||
import Data.Time.Clock.POSIX
|
import Data.Time.Clock.POSIX
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
@ -45,3 +46,13 @@ stubTransferInfo = TransferInfo Nothing Nothing Nothing Nothing Nothing Nothing
|
||||||
data Direction = Upload | Download
|
data Direction = Upload | Download
|
||||||
deriving (Eq, Ord, Read, Show)
|
deriving (Eq, Ord, Read, Show)
|
||||||
|
|
||||||
|
instance Arbitrary TransferInfo where
|
||||||
|
arbitrary = TransferInfo
|
||||||
|
<$> arbitrary
|
||||||
|
<*> arbitrary
|
||||||
|
<*> pure Nothing -- cannot generate a ThreadID
|
||||||
|
<*> pure Nothing -- remote not needed
|
||||||
|
<*> arbitrary
|
||||||
|
-- associated file cannot be empty (but can be Nothing)
|
||||||
|
<*> arbitrary `suchThat` (/= Just "")
|
||||||
|
<*> arbitrary
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue