summaryrefslogtreecommitdiff
path: root/Types
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-09-05 14:52:06 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-09-05 14:52:06 -0400
commit31f118f51dc3a8a32c0257209544dfb50542f696 (patch)
tree85ce438e443cf678b21fbfb980ff2473c737f657 /Types
parent747da87efa9c234015cd0be9db9cbdcf4f5c7336 (diff)
move Arbitrary instance to new Types.Transfer module
Avoid orphan instance warning
Diffstat (limited to 'Types')
-rw-r--r--Types/Transfer.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Types/Transfer.hs b/Types/Transfer.hs
index 528d1d5cb..905b29ea2 100644
--- a/Types/Transfer.hs
+++ b/Types/Transfer.hs
@@ -9,6 +9,7 @@ module Types.Transfer where
import Types
import Utility.PID
+import Utility.QuickCheck
import Data.Time.Clock.POSIX
import Control.Concurrent
@@ -45,3 +46,13 @@ stubTransferInfo = TransferInfo Nothing Nothing Nothing Nothing Nothing Nothing
data Direction = Upload | Download
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