genvalidity-aeson (empty) → 0.0.0.0
raw patch · 6 files changed
+132/−0 lines, 6 filesdep +QuickCheckdep +aesondep +basesetup-changed
Dependencies added: QuickCheck, aeson, base, genvalidity, genvalidity-aeson, genvalidity-hspec, genvalidity-scientific, genvalidity-text, genvalidity-unordered-containers, genvalidity-vector, hspec, validity, validity-aeson
Files
- LICENSE +21/−0
- Setup.hs +3/−0
- genvalidity-aeson.cabal +51/−0
- src/Data/GenValidity/Aeson.hs +44/−0
- test/Spec.hs +1/−0
- test/Test/Validity/AesonSpec.hs +12/−0
+ LICENSE view
@@ -0,0 +1,21 @@+The MIT License (MIT)++Copyright (c) 2016 Tom Sydney Kerckhove++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple++main = defaultMain
+ genvalidity-aeson.cabal view
@@ -0,0 +1,51 @@+name: genvalidity-aeson+version: 0.0.0.0+cabal-version: >=1.10+build-type: Simple+license: MIT+license-file: LICENSE+copyright: Copyright: (c) 2017 Tom Sydney Kerckhove+maintainer: syd.kerckhove@gmail.com+homepage: https://github.com/NorfairKing/validity#readme+synopsis: GenValidity support for aeson+description:+ Please see README.md+category: Testing+author: Tom Sydney Kerckhove++source-repository head+ type: git+ location: https://github.com/NorfairKing/validity++library+ exposed-modules:+ Data.GenValidity.Aeson+ build-depends:+ base <5,+ QuickCheck -any,+ genvalidity >=0.3 && <0.4,+ validity >=0.3 && <0.4,+ validity-aeson >= 0.0 && < 0.1,+ genvalidity-text >= 0.3 && < 0.4,+ genvalidity-vector >= 0.0 && < 0.1,+ genvalidity-unordered-containers >= 0.0 && < 0.1,+ genvalidity-scientific >= 0.0 && < 0.1,+ aeson -any+ default-language: Haskell2010+ hs-source-dirs: src++test-suite genvalidity-aeson-test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ build-depends:+ base >=4.9 && <=5,+ genvalidity -any,+ genvalidity-hspec -any,+ genvalidity-aeson -any,+ hspec >=2.2 && <2.5,+ aeson -any+ default-language: Haskell2010+ hs-source-dirs: test/+ other-modules:+ Test.Validity.AesonSpec+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ src/Data/GenValidity/Aeson.hs view
@@ -0,0 +1,44 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# LANGUAGE CPP #-}++module Data.GenValidity.Aeson where+#if !MIN_VERSION_base(4,8,0)+import Data.Functor ((<$>))+#endif+import Data.GenValidity+import Data.GenValidity.HashMap ()+import Data.GenValidity.Text ()+import Data.GenValidity.Vector ()+import Data.GenValidity.Scientific ()+import Data.Validity.Aeson ()++import Data.Aeson++import Test.QuickCheck++instance GenUnchecked Value where+ genUnchecked =+ oneof+ [ Object <$> genUnchecked+ , Array <$> genUnchecked+ , String <$> genUnchecked+ , Number <$> genUnchecked+ , Bool <$> genUnchecked+ , pure Null+ ]++instance GenValid Value where+ genValid =+ oneof+ [ Object <$> genValid+ , Array <$> genValid+ , String <$> genValid+ , Number <$> genValid+ , Bool <$> genValid+ , pure Null+ ]++instance GenInvalid Value where+ genInvalid =+ oneof+ [Object <$> genInvalid, Array <$> genInvalid, String <$> genInvalid]
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
+ test/Test/Validity/AesonSpec.hs view
@@ -0,0 +1,12 @@+{-# LANGUAGE TypeApplications #-}++module Test.Validity.AesonSpec where++import Test.Hspec++import Data.GenValidity.Aeson ()+import Test.Validity.GenValidity+import Data.Aeson (Value)++spec :: Spec+spec = genValiditySpec @Value