packages feed

nri-test-encoding 0.1.1.0 → 0.1.1.1

raw patch · 4 files changed

+35/−33 lines, 4 filesdep ~aesonPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson

API changes (from Hackage documentation)

- Redis.Test: encoding :: forall m key a. (Typeable a, HasExamples a) => m key a -> Test
+ Test.Encoding.Redis: test :: forall m key a. (Typeable a, HasExamples a) => m key a -> Test

Files

CHANGELOG.md view
@@ -1,4 +1,6 @@-# Unreleased next version+# 0.1.1.1++- Support `aeson-2.0.x`.  # 0.1.1.0 
nri-test-encoding.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           nri-test-encoding-version:        0.1.1.0+version:        0.1.1.1 synopsis:       A library to simplify writing golden tests for encoding types. description:    Please see the README at <https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-test-encoding#readme>. category:       Testing@@ -31,8 +31,8 @@   exposed-modules:       Examples       Test.Encoding+      Test.Encoding.Redis       Test.Encoding.Routes-      Redis.Test   other-modules:       Paths_nri_test_encoding   hs-source-dirs:@@ -53,7 +53,7 @@       TypeOperators   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns   build-depends:-      aeson >=1.4.6.0 && <1.6+      aeson >=1.4.6.0 && <2.1     , aeson-pretty >=0.8.0 && <0.9     , base >=4.12.0.0 && <4.16     , bytestring >=0.10.8.2 && <0.12
− src/Redis/Test.hs
@@ -1,29 +0,0 @@--- | Useful to test encoding of data stored in redis.-module Redis.Test (encoding) where--import Data.Proxy (Proxy (Proxy))-import qualified Data.Typeable as Typeable-import qualified Examples-import NriPrelude-import Test (Test)-import qualified Test.Encoding-import qualified Text---- | Turns a Redis.Api into a test.--- The test does the following:------ 1. get examples from the `HasExamples` constraint--- 2. encoded the examples into JSON--- 3. check the encoded JSON against the generated file---   NOTE: it will generate the file if it doesn't exist yet-encoding :: forall m key a. (Typeable.Typeable a, Examples.HasExamples a) => m key a -> Test-encoding _ =-  let proxy = Proxy :: Proxy a-      tyCon =-        Typeable.typeRep proxy-          |> Typeable.typeRepTyCon-      typeName =-        Typeable.tyConModule tyCon ++ "." ++ Typeable.tyConName tyCon-          |> Text.fromList-   in Examples.examples proxy-        |> Test.Encoding.examplesToTest typeName ("redis-encoding-" ++ typeName)
+ src/Test/Encoding/Redis.hs view
@@ -0,0 +1,29 @@+-- | Useful to test encoding of data stored in redis.+module Test.Encoding.Redis (test) where++import Data.Proxy (Proxy (Proxy))+import qualified Data.Typeable as Typeable+import qualified Examples+import NriPrelude+import Test (Test)+import qualified Test.Encoding+import qualified Text++-- | Turns a Redis.Api into a test.+-- The test does the following:+--+-- 1. get examples from the `HasExamples` constraint+-- 2. encoded the examples into JSON+-- 3. check the encoded JSON against the generated file+--   NOTE: it will generate the file if it doesn't exist yet+test :: forall m key a. (Typeable.Typeable a, Examples.HasExamples a) => m key a -> Test+test _ =+  let proxy = Proxy :: Proxy a+      tyCon =+        Typeable.typeRep proxy+          |> Typeable.typeRepTyCon+      typeName =+        Typeable.tyConModule tyCon ++ "." ++ Typeable.tyConName tyCon+          |> Text.fromList+   in Examples.examples proxy+        |> Test.Encoding.examplesToTest typeName ("redis-encoding-" ++ typeName)