git.iko.soy/typeable/hjsonpointer
on master help sign in
Merge pull request #5 from mmhat/no-quickcheck
84f02e6Ian Jeffries
hjsonpointer.cabal−1
@@ -27,7 +27,6 @@ library
27 base >= 4.6 && < 5
27 base >= 4.6 && < 5
28 , aeson >= 0.7
28 , aeson >= 0.7
29 , hashable >= 1.2
29 , hashable >= 1.2
30− , QuickCheck >= 2.8
31 , unordered-containers >= 0.2
30 , unordered-containers >= 0.2
32 , text >= 1.2
31 , text >= 1.2
33 , vector >= 0.10
32 , vector >= 0.10
src/JSONPointer.hs+1−5
@@ -13,7 +13,6 @@ import Data.Text (Text)
13import qualified Data.Text as T
13import qualified Data.Text as T
14import qualified Data.Vector as V
14import qualified Data.Vector as V
15import GHC.Generics (Generic)
15import GHC.Generics (Generic)
16−import Test.QuickCheck
17import Text.Read (readMaybe)
16import Text.Read (readMaybe)
18
17
19--------------------------------------------------
18--------------------------------------------------
@@ -37,7 +36,7 @@ resolve (Pointer (t:ts)) v = resolveToken t v >>= resolve (Pointer ts)
37
36
38newtype Pointer
37newtype Pointer
39 = Pointer { _unPointer :: [Token] }
38 = Pointer { _unPointer :: [Token] }
40− deriving (Eq, Show, Semigroup, Monoid, Generic, Arbitrary)
39+ deriving (Eq, Show, Semigroup, Monoid, Generic)
41
40
42instance HA.Hashable Pointer
41instance HA.Hashable Pointer
43
42
@@ -63,9 +62,6 @@ newtype Token
63
62
64instance HA.Hashable Token
63instance HA.Hashable Token
65
64
66−instance Arbitrary Token where
67− arbitrary = Token . T.pack <$> arbitrary
68−
69-- | This escapes @"/"@ (because it's the token separator character).
65-- | This escapes @"/"@ (because it's the token separator character).
70--
66--
71-- It also escapes @"~"@ (because it's the escape character).
67-- It also escapes @"~"@ (because it's the escape character).
test/Unit.hs+10−1
@@ -1,3 +1,7 @@
1+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2+{-# LANGUAGE StandaloneDeriving #-}
3+
4+{-# OPTIONS_GHC -fno-warn-orphans #-}
1
5
2module Main where
6module Main where
3
7
@@ -13,10 +17,15 @@ import qualified JSONPointer as JP
13import Network.HTTP.Types.URI (urlDecode)
17import Network.HTTP.Types.URI (urlDecode)
14
18
15import Test.Hspec
19import Test.Hspec
16−import Test.QuickCheck (property)
20+import Test.QuickCheck (Arbitrary(..), property)
17
21
18import qualified Example
22import qualified Example
19
23
24+deriving instance Arbitrary JP.Pointer
25+
26+instance Arbitrary JP.Token where
27+ arbitrary = JP.Token . T.pack <$> arbitrary
28+
20main :: IO ()
29main :: IO ()
21main = hspec $ do
30main = hspec $ do
22 describe "example" $ do
31 describe "example" $ do