]> Git — Sourcephile - gargantext.git/blob - src-test/Parsers/Types.hs
Merge branch 'master' into fromRFC3339
[gargantext.git] / src-test / Parsers / Types.hs
1 {-# LANGUAGE NoImplicitPrelude #-}
2 {-# LANGUAGE StandaloneDeriving #-}
3
4 module Parsers.Types where
5
6 import Gargantext.Prelude
7
8 import Test.QuickCheck
9 import Test.QuickCheck.Instances()
10
11 import Text.Parsec.Pos
12 import Text.Parsec.Error (ParseError, Message(..), newErrorMessage)
13 import Data.Time.LocalTime (ZonedTime (..))
14 import Data.Eq (Eq(..))
15 deriving instance Eq ZonedTime
16
17 instance Arbitrary Message where
18 arbitrary = do
19 msgContent <- arbitrary
20 oneof $ return <$> [SysUnExpect msgContent
21 , UnExpect msgContent
22 , Expect msgContent
23 , Message msgContent
24 ]
25
26 instance Arbitrary SourcePos where
27 arbitrary = do
28 sn <- arbitrary
29 l <- arbitrary
30 c <- arbitrary
31 return $ newPos sn l c
32
33 instance Arbitrary ParseError where
34 arbitrary = do
35 sp <- arbitrary
36 msg <- arbitrary
37 return $ newErrorMessage msg sp