store 0.2.1.1 → 0.2.1.2
raw patch · 2 files changed
+25/−7 lines, 2 filesdep ~basedep ~store-core
Dependency ranges changed: base, store-core
Files
- store.cabal +6/−6
- test/Data/StoreSpec.hs +19/−1
store.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.14.0.+-- This file has been generated from package.yaml by hpack version 0.14.1. -- -- see: https://github.com/sol/hpack name: store-version: 0.2.1.1+version: 0.2.1.2 synopsis: Fast binary serialization homepage: https://github.com/fpco/store#readme bug-reports: https://github.com/fpco/store/issues@@ -48,7 +48,7 @@ Data.Store.Impl build-depends: base >=4.7 && <5- , store-core >=0.2 && <0.3+ , store-core >=0.2.0.2 && <0.3 , th-utilities >=0.2 , primitive >=0.6 , th-reify-many >=0.1.6@@ -99,7 +99,7 @@ ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -O2 -threaded -rtsopts -with-rtsopts=-N build-depends: base >=4.7 && <5- , store-core >=0.2 && <0.3+ , store-core >=0.2.0.2 && <0.3 , th-utilities >=0.2 , primitive >=0.6 , th-reify-many >=0.1.6@@ -153,7 +153,7 @@ ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -O2 -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T -O2 build-depends: base >=4.7 && <5- , store-core >=0.2 && <0.3+ , store-core >=0.2.0.2 && <0.3 , th-utilities >=0.2 , primitive >=0.6 , th-reify-many >=0.1.6@@ -213,7 +213,7 @@ ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -O2 -threaded -rtsopts -with-rtsopts=-N1 -with-rtsopts=-s -with-rtsopts=-qg build-depends: base >=4.7 && <5- , store-core >=0.2 && <0.3+ , store-core >=0.2.0.2 && <0.3 , th-utilities >=0.2 , primitive >=0.6 , th-reify-many >=0.1.6
test/Data/StoreSpec.hs view
@@ -54,7 +54,7 @@ import Data.Word import Foreign.C.Types import Foreign.Ptr-import Foreign.Storable (Storable)+import Foreign.Storable (Storable, sizeOf) import GHC.Fingerprint.Type (Fingerprint(..)) import GHC.Generics import GHC.Real (Ratio(..))@@ -369,6 +369,24 @@ it "Faulty implementations of size lead to PokeExceptions" $ do evaluate (encode (BadIdea 0)) `shouldThrow` isPokeException evaluate (encode (BadIdea2 0)) `shouldThrow` isPokeException+ it "Avoids reading data with a negative size" $ do+ let bs = encode (SV.fromList [1..10::Int])+ bs' = BS.concat [encode (-1 :: Int)+ , BS.drop (sizeOf (10 :: Int)) bs+ ]+ evaluate (decodeEx bs' :: SV.Vector Int) `shouldThrow` isNegativeBytesException+ it "Avoids overflow in bounds checks" $ do+ let bs = encode ("some random bytestring" :: BS.ByteString)+ bs' = BS.concat [encode (maxBound :: Int)+ , BS.drop (sizeOf (10 :: Int)) bs+ ]+ evaluate (decodeEx bs' :: BS.ByteString) `shouldThrow` isTooManyBytesException isPokeException :: Test.Hspec.Selector PokeException isPokeException = const True++isNegativeBytesException :: Test.Hspec.Selector PeekException+isNegativeBytesException (PeekException _ t) = "Attempted to read negative number of bytes" `T.isPrefixOf` t++isTooManyBytesException :: Test.Hspec.Selector PeekException+isTooManyBytesException (PeekException _ t) = "Attempted to read too many bytes" `T.isPrefixOf` t