binary-ext 1.0 → 1.0.8.5.1
raw patch · 3 files changed
+66/−23 lines, 3 files
Files
- binary-ext.cabal +8/−7
- src/Data/Binary/Get/Ext.hs +0/−1
- tests/QC.hs +58/−15
binary-ext.cabal view
@@ -1,5 +1,5 @@ name: binary-ext-version: 1.0+version: 1.0.8.5.1 license: BSD3 license-file: LICENSE author: Warlock <internalmike@gmail.com>@@ -11,7 +11,7 @@ stability: provisional build-type: Simple cabal-version: >= 1.8-tested-with: GHC == 8.0.1+tested-with: GHC == 8.0.2 extra-source-files: README.md @@ -20,7 +20,8 @@ location: git://github.com/A1-Triard/binary-ext.git library- build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array, binary+ build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array+ , binary hs-source-dirs: src exposed-modules: Data.Binary.Get.Ext , Data.Binary.Get.Ext.Internal@@ -36,9 +37,9 @@ if impl(ghc >= 8.0) ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances --- Due to circular dependency, we cannot make any of the test-suites--- depend on the binary library. Instead, for each test-suite,--- we include the source directory of binary and build-depend on all+-- Due to circular dependency, we cannot make any of the test-suites or+-- benchmark depend on the binary library. Instead, for each test-suite and+-- benchmark, we include the source directory of binary and build-depend on all -- the dependencies binary has. test-suite qc@@ -81,7 +82,7 @@ -- build dependencies from using binary source rather than depending on the library build-depends: array, containers- ghc-options: -Wall+ ghc-options: -Wall -Wno-unused-imports if impl(ghc <= 7.6) -- prior to ghc-7.4 generics lived in ghc-prim build-depends: ghc-prim
src/Data/Binary/Get/Ext.hs view
@@ -6,7 +6,6 @@ #endif module Data.Binary.Get.Ext (- -- * The Get monad Get
tests/QC.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, ScopedTypeVariables #-}+{-# LANGUAGE CPP, ScopedTypeVariables, DataKinds, TypeSynonymInstances #-} module Main ( main ) where #if MIN_VERSION_base(4,8,0)@@ -9,26 +9,36 @@ #define HAS_FIXED_CONSTRUCTOR #endif -import Control.Applicative-import Control.Exception as C (SomeException, catch, evaluate)-import Control.Monad (unless)-import qualified Data.ByteString as B-import qualified Data.ByteString.Lazy as L-import qualified Data.ByteString.Lazy.Internal as L-import Data.Int-import Data.Ratio-import System.IO.Unsafe+import Control.Applicative+import Control.Exception as C (SomeException,+ catch, evaluate)+import Control.Monad (unless, liftM2)+import qualified Data.ByteString as B+import qualified Data.ByteString.Lazy as L+import qualified Data.ByteString.Lazy.Internal as L+#if MIN_VERSION_bytestring(0,10,4)+import Data.ByteString.Short (ShortByteString)+#endif+import Data.Int+import Data.Ratio+import Data.Typeable+import System.IO.Unsafe #ifdef HAS_NATURAL import Numeric.Natural #endif -import Test.Framework-import Test.Framework.Providers.QuickCheck2-import Test.QuickCheck+import GHC.Fingerprint -import qualified Action (tests)-import Arbitrary ()+import qualified Data.Fixed as Fixed++import Test.Framework+import Test.Framework.Providers.QuickCheck2+import Test.QuickCheck++import qualified Action (tests)+import Arbitrary ()+ import Data.Binary hiding (Get, get, getWord8) import Data.Binary.Get.Ext hiding ( getLazyByteString, getLazyByteStringNul, getWord8@@ -246,6 +256,38 @@ prop_Doublehost = roundTripWith putDoublehost getDoublehost -} +#if MIN_VERSION_base(4,10,0)+testTypeable :: Test+testTypeable = testProperty "TypeRep" prop_TypeRep++prop_TypeRep :: TypeRep -> Property+prop_TypeRep = roundTripWith Class.put Class.get++atomicTypeReps :: [TypeRep]+atomicTypeReps =+ [ typeRep (Proxy :: Proxy ())+ , typeRep (Proxy :: Proxy String)+ , typeRep (Proxy :: Proxy Int)+ , typeRep (Proxy :: Proxy (,))+ , typeRep (Proxy :: Proxy ((,) (Maybe Int)))+ , typeRep (Proxy :: Proxy Maybe)+ , typeRep (Proxy :: Proxy 'Nothing)+ , typeRep (Proxy :: Proxy 'Left)+ , typeRep (Proxy :: Proxy "Hello")+ , typeRep (Proxy :: Proxy 42)+ , typeRep (Proxy :: Proxy '[1,2,3,4])+ , typeRep (Proxy :: Proxy ('Left Int))+ , typeRep (Proxy :: Proxy (Either Int String))+ , typeRep (Proxy :: Proxy (() -> ()))+ ]++instance Arbitrary TypeRep where+ arbitrary = oneof (map pure atomicTypeReps)+#else+testTypeable :: Test+testTypeable = testGroup "Skipping Typeable tests" []+#endif+ -- done, partial and fail -- | Test partial results.@@ -736,4 +778,5 @@ , ("L.ByteString invariant", p (prop_invariant :: B L.ByteString )) , ("[L.ByteString] invariant", p (prop_invariant :: B [L.ByteString] )) ]+ , testTypeable ]