From 1d562d18c0c274cab10e83b38c51ae448e8077c5 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Fri, 24 Aug 2018 15:29:51 +0200 Subject: [PATCH] Removed dependency on QuickCheck --- hjsonpointer.cabal | 1 - src/JSONPointer.hs | 6 +----- test/Unit.hs | 11 ++++++++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hjsonpointer.cabal b/hjsonpointer.cabal index 6b203df..1ea534f 100644 --- a/hjsonpointer.cabal +++ b/hjsonpointer.cabal @@ -27,7 +27,6 @@ library base >= 4.6 && < 5 , aeson >= 0.7 , hashable >= 1.2 - , QuickCheck >= 2.8 , unordered-containers >= 0.2 , text >= 1.2 , vector >= 0.10 diff --git a/src/JSONPointer.hs b/src/JSONPointer.hs index 6b374f2..4df43f1 100644 --- a/src/JSONPointer.hs +++ b/src/JSONPointer.hs @@ -13,7 +13,6 @@ import Data.Text (Text) import qualified Data.Text as T import qualified Data.Vector as V import GHC.Generics (Generic) -import Test.QuickCheck import Text.Read (readMaybe) -------------------------------------------------- @@ -37,7 +36,7 @@ resolve (Pointer (t:ts)) v = resolveToken t v >>= resolve (Pointer ts) newtype Pointer = Pointer { _unPointer :: [Token] } - deriving (Eq, Show, Semigroup, Monoid, Generic, Arbitrary) + deriving (Eq, Show, Semigroup, Monoid, Generic) instance HA.Hashable Pointer @@ -63,9 +62,6 @@ newtype Token instance HA.Hashable Token -instance Arbitrary Token where - arbitrary = Token . T.pack <$> arbitrary - -- | This escapes @"/"@ (because it's the token separator character). -- -- It also escapes @"~"@ (because it's the escape character). diff --git a/test/Unit.hs b/test/Unit.hs index d392685..7966cf8 100644 --- a/test/Unit.hs +++ b/test/Unit.hs @@ -1,3 +1,7 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE StandaloneDeriving #-} + +{-# OPTIONS_GHC -fno-warn-orphans #-} module Main where @@ -13,10 +17,15 @@ import qualified JSONPointer as JP import Network.HTTP.Types.URI (urlDecode) import Test.Hspec -import Test.QuickCheck (property) +import Test.QuickCheck (Arbitrary(..), property) import qualified Example +deriving instance Arbitrary JP.Pointer + +instance Arbitrary JP.Token where + arbitrary = JP.Token . T.pack <$> arbitrary + main :: IO () main = hspec $ do describe "example" $ do