network-arbitrary 0.6.0.0 → 1.0.0.1
raw patch · 12 files changed
Files
- COPYRIGHT +0/−1
- ChangeLog.md +50/−0
- README.md +38/−25
- Setup.hs +1/−0
- network-arbitrary.cabal +55/−98
- src/Network/Arbitrary.hs +11/−16
- src/Network/HTTP/Media/MediaType/Arbitrary.hs +48/−37
- src/Network/HTTP/Types/Method/Arbitrary.hs +15/−15
- src/Network/URI/Arbitrary.hs +111/−92
- test/Network/HTTP/Media/MediaType/ArbitrarySpec.hs +31/−25
- test/Network/HTTP/Types/Method/ArbitrarySpec.hs +30/−27
- test/Network/URI/ArbitrarySpec.hs +27/−25
− COPYRIGHT
@@ -1,1 +0,0 @@-Copyright 2018 Alex Brandt <alunduil@gmail.com>
ChangeLog.md view
@@ -1,5 +1,55 @@ # Revision history for network-arbitrary +## unreleased++## 1.0.0.1 -- 2024-05-26++### Added++* Support for base 4.20.0 and newer++### Deprecated++* GHC testing of 9.4+* GHC testing of 9.6++### Removed++* GHC testing for older than 9.4++## 1.0.0.0 -- 2024-04-24++### Added++* GHC testing for 9.2.*, 9.4.*, 9.6.*, 9.8.*+* Support for base 4.15, 4.16, 4.17, 4.18, and 4.19+* Support for bytestring 0.11.1.0 and newer, and 0.12.0.0 and newer+* Support for QuickCheck 2.15++### Changed++### Deprecated++* GHC testing for older than 9.4++### Fixed++### Removed++* GHC testing for <8.6.4++### Security++## 0.7.0.0 -- 2020-11-30++* Update project structure+ * stylish-haskell configuration+ * updated travis configuration+ * pre-commit+ * nix-shell with mkShell+* Bump base dependence version+* Generate relative references as well+ ## 0.6.0.0 -- 2020-04-11 * Update project structure.
README.md view
@@ -1,37 +1,50 @@-# Description+# network-arbitrary -[Arbitrary] Instances for [Network][network-category] Types+[Homepage](https://github.com/alunduil/network-arbitrary)+By Alex Brandt <alunduil@gmail.com> -I am providing code in the repository to you under an open source license.-Because this is my personal repository, the license you receive to my code is-from me and not my employer (Facebook).+## Description -# Getting Started+You can use network-arbitrary to provide Arbitrary instances for Network module types. -Documentation is available on [Hackage]. A great guide to [QuickCheck] is-<https://begriffs.com/posts/2017-01-14-design-use-quickcheck.html>.+## Terms of use -# Reporting Issues+You are free to use network-arbitrary without any conditions. See the [LICENSE]+file for details. -Any issues discovered should be recorded on [github][issues]. If you believe-you've found an error or have a suggestion for a new feature; please, ensure-that it is reported.+## How to use network-arbitrary -If you would like to contribute a fix or new feature; please, submit a pull-request. This project follows [git flow] and utilizes [travis] to automatically-check pull requests before a manual review.+```haskell+{-# LANGUAGE TypeApplications #-}+module main where -# Contributors+import Network.URI (URI)+import Network.URI.Arbitrary () -The `COPYRIGHT` file contains a list of contributors with their respective-copyrights and other information. If you submit a pull request and would like-attribution; please, add yourself to the `COPYRIGHT` file.+main = generate (arbitrary @URI) >>= print+``` -[Arbitrary]: https://hackage.haskell.org/package/QuickCheck/docs/Test-QuickCheck-Arbitrary.html#t:Arbitrary-[git flow]: http://nvie.com/posts/a-successful-git-branching-model/-[Hackage]: https://hackage.haskell.org/package/network-arbitrary-[Haskell]: https://www.haskell.org/+## Documentation++* [Hackage][hackage]: Hackage project page for network-arbitrary+* [The Design and Use of QuickCheck](https://begriffs.com/posts/2017-01-14-design-use-quickcheck.html): An excellent guide to using QuickCheck+* [LICENSE](./LICENSE): The license governing use of network-arbitrary+* [QuickCheck Arbitrary][arbitrary]: QuickCheck's Arbitrary class documentation+* [Hackage's Network Category][network-category]: Hackage's Network category+* [QuickCheck][quickcheck]: QuickCheck's documentation++## Getting Help++* [GitHub Issues][issues]: Support requests, bug reports, and feature requests++## How to Help++* Submit [issues] for problems or questions+* Submit [pull requests] for proposed changes++[arbitrary]: https://hackage.haskell.org/package/QuickCheck/docs/Test-QuickCheck-Arbitrary.html#t:Arbitrary+[hackage]: https://hackage.haskell.org/package/network-arbitrary [issues]: https://github.com/alunduil/network-arbitrary/issues [network-category]: https://hackage.haskell.org/packages/#cat:Network-[QuickCheck]: https://hackage.haskell.org/package/QuickCheck-[travis]: https://travis-ci.org/alunduil/network-arbitrary+[pull requests]: https://github.com/alunduil/network-arbitrary/pulls+[quickcheck]: https://hackage.haskell.org/package/QuickCheck
Setup.hs view
@@ -1,2 +1,3 @@ import Distribution.Simple+ main = defaultMain
network-arbitrary.cabal view
@@ -1,115 +1,72 @@-name: network-arbitrary-version: 0.6.0.0--license: MIT-license-file: LICENSE--copyright: (c) 2018 Alex Brandt--author: Alex Brandt-maintainer: alunduil@gmail.com--stability: stable--homepage: https://github.com/alunduil/network-arbitrary-bug-reports: https://github.com/alunduil/network-arbitrary/issues--synopsis: Arbitrary Instances for Network Types+cabal-version: 3.0+name: network-arbitrary+version: 1.0.0.1+license: MIT+license-file: LICENSE+copyright: (c) 2018 Alex Brandt+author: Alex Brandt+maintainer: alunduil@gmail.com+stability: stable+homepage: https://github.com/alunduil/network-arbitrary+bug-reports: https://github.com/alunduil/network-arbitrary/issues+synopsis: Arbitrary Instances for Network Types description:- Arbitrary instances for Network types.--category: Testing+ You can use network-arbitrary to provide Arbitrary instances for Network+ module types. -cabal-version: >= 1.10-build-type: Simple-tested-with: GHC >= 7.6 && < 8.2.1 || > 8.2.1 && < 9.0+category: Testing+tested-with:+ GHC >=9.4 && <9.5 || >=9.6 && <9.7 || >=9.8 && <9.9 || >=9.10 && <9.11 extra-source-files:- ChangeLog.md- , COPYRIGHT- , LICENSE- , README.md- , Setup.hs--library- ghc-options:- -Wall- if impl(ghc >= 8) {- ghc-options:- -Wcompat- } else {- ghc-options:- -fwarn-monomorphism-restriction- -fwarn-tabs- -fwarn-unused-do-bind- }+ ChangeLog.md+ README.md - default-language: Haskell2010+source-repository head+ type: git+ location: https://github.com/alunduil/network-arbitrary +common network-arbitrary-common build-depends:- base >= 4.6 && < 4.14- , bytestring == 0.10.*- , http-media >= 0.6 && < 0.9- , http-types >= 0.9 && < 0.13- , network-uri == 2.6.*- , QuickCheck >= 2.9 && < 2.14+ , base >=4.6 && <4.15 || ^>=4.15.0.0 || ^>=4.16.0.0 || ^>=4.17.0.0 || ^>=4.18.0.0 || ^>=4.19.0.0 || ^>=4.20.0+ , bytestring >=0.10 && <0.11 || ^>=0.11.1.0 || ^>=0.12.0.0+ , http-media >=0.6 && <0.9+ , http-types >=0.9 && <0.13+ , network-uri >=2.6 && <2.8+ , QuickCheck ^>=2.9 || ^>=2.10 || ^>=2.11 || ^>=2.12 || ^>=2.13 || ^>=2.14 || ^>=2.15 +library+ import: network-arbitrary-common exposed-modules:- Network.Arbitrary- , Network.HTTP.Media.MediaType.Arbitrary- , Network.HTTP.Types.Method.Arbitrary- , Network.URI.Arbitrary+ Network.Arbitrary+ Network.HTTP.Media.MediaType.Arbitrary+ Network.HTTP.Types.Method.Arbitrary+ Network.URI.Arbitrary other-modules:-- hs-source-dirs:- src--test-suite network-arbitrary-tests- type: exitcode-stdio-1.0- main-is: Spec.hs-- ghc-options:- -Wall- if impl(ghc >= 8) {- ghc-options:- -Wcompat- } else {- ghc-options:- -fwarn-monomorphism-restriction- -fwarn-tabs- -fwarn-unused-do-bind- }-+ build-depends:+ hs-source-dirs: src default-language: Haskell2010+ ghc-options: -Wall -Wcompat +test-suite test+ import: network-arbitrary-common+ type: exitcode-stdio-1.0+ main-is: Spec.hs build-depends:- base >= 4.6 && < 4.14- , bytestring == 0.10.*- , case-insensitive == 1.2.*- , hspec >= 2.4 && < 2.8- , http-media >= 0.6 && < 0.9- , http-types >= 0.9 && < 0.13- , network-uri == 2.6.*- , QuickCheck >= 2.9 && < 2.14- , test-invariant == 0.4.*-- build-tool-depends:- hspec-discover:hspec-discover >= 2.4 && < 2.8+ , case-insensitive >=1.2 && <1.3+ , hspec >=2.4 && <2.8 || ^>=2.11.8+ , test-invariant >=0.4 && <0.5 + build-tool-depends: hspec-discover:hspec-discover >=2.4 && <2.8 other-modules:- Network.HTTP.Media.MediaType.Arbitrary- , Network.HTTP.Media.MediaType.ArbitrarySpec- , Network.HTTP.Types.Method.Arbitrary- , Network.HTTP.Types.Method.ArbitrarySpec- , Network.URI.Arbitrary- , Network.URI.ArbitrarySpec-- hs-source-dirs:- src- , test+ Network.HTTP.Media.MediaType.Arbitrary+ Network.HTTP.Media.MediaType.ArbitrarySpec+ Network.HTTP.Types.Method.Arbitrary+ Network.HTTP.Types.Method.ArbitrarySpec+ Network.URI.Arbitrary+ Network.URI.ArbitrarySpec -source-repository head- type: git- location: https://github.com/alunduil/network-arbitrary- branch: develop+ hs-source-dirs: src test+ default-language: Haskell2010+ ghc-options: -Wall -Wcompat
src/Network/Arbitrary.hs view
@@ -1,17 +1,12 @@-{-|-Module : Network.Arbitrary-Description : Arbitrary Instances for Network-Copyright : (c) Alex Brandt, 2018-License : MIT--Arbitrary instances for "Network".--}-module Network.Arbitrary- ()-where+-- |+-- Module : Network.Arbitrary+-- Description : Arbitrary Instances for Network+-- Copyright : (c) Alex Brandt, 2018+-- License : MIT+--+-- Arbitrary instances for "Network".+module Network.Arbitrary () where -import Network.HTTP.Media.MediaType.Arbitrary- ( )-import Network.HTTP.Types.Method.Arbitrary- ( )-import Network.URI.Arbitrary ( )+import Network.HTTP.Media.MediaType.Arbitrary ()+import Network.HTTP.Types.Method.Arbitrary ()+import Network.URI.Arbitrary ()
src/Network/HTTP/Media/MediaType/Arbitrary.hs view
@@ -1,39 +1,48 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -{-|-Module : Network.HTTP.Media.MediaType.Arbitrary-Description : Arbitrary Instances for Network.HTTP.Media.MediaType-Copyright : (c) Alex Brandt, 2018-License : MIT--Arbitrary instances for "Network.HTTP.Media.MediaType".--}-module Network.HTTP.Media.MediaType.Arbitrary- ()-where--import Prelude hiding ( concat )+-- |+-- Module : Network.HTTP.Media.MediaType.Arbitrary+-- Description : Arbitrary Instances for Network.HTTP.Media.MediaType+-- Copyright : (c) Alex Brandt, 2018+-- License : MIT+--+-- Arbitrary instances for "Network.HTTP.Media.MediaType".+module Network.HTTP.Media.MediaType.Arbitrary () where -import Control.Applicative ( (<*>) )-import Control.Monad ( replicateM )-import Data.ByteString ( append- , concat- , ByteString- )-import Data.ByteString.Char8 ( singleton )-import Data.Functor ( (<$>) )-import Network.HTTP.Media.MediaType ( (/:)- , (//)- , MediaType- )-import Test.QuickCheck ( Arbitrary(arbitrary)- , choose- , elements- , Gen- , listOf- , oneof- , sized- )+import Control.Applicative+ ( (<*>),+ )+import Control.Monad+ ( replicateM,+ )+import Data.ByteString+ ( ByteString,+ append,+ concat,+ )+import Data.ByteString.Char8+ ( singleton,+ )+import Data.Functor+ ( (<$>),+ )+import Network.HTTP.Media.MediaType+ ( MediaType,+ (//),+ (/:),+ )+import Test.QuickCheck+ ( Arbitrary (arbitrary),+ Gen,+ choose,+ elements,+ listOf,+ oneof,+ sized,+ )+import Prelude hiding+ ( concat,+ ) -- --@@ -43,7 +52,7 @@ -- shall simply use restrictedName for the values as well. instance Arbitrary MediaType where arbitrary = do- n <- (//) <$> restrictedName <*> restrictedName+ n <- (//) <$> restrictedName <*> restrictedName ps <- listOf $ (,) <$> restrictedName <*> restrictedName -- see parameter note above return $ foldl (/:) n ps @@ -51,7 +60,7 @@ restrictedName :: Gen ByteString restrictedName = sized $ \s -> do- n <- choose (0, min 126 s)+ n <- choose (0, min 126 s) rs <- concat <$> replicateM n restrictedNameChar (`append` rs) <$> restrictedNameFirst @@ -59,8 +68,10 @@ restrictedNameFirst = singleton <$> oneof [alpha, digit] restrictedNameChar :: Gen ByteString-restrictedNameChar = singleton <$> oneof- [alpha, digit, elements ['!', '#', '$', '&', '-', '^', '_', '.', '+']]+restrictedNameChar =+ singleton+ <$> oneof+ [alpha, digit, elements ['!', '#', '$', '&', '-', '^', '_', '.', '+']] -- * RFC 2234 Generators
src/Network/HTTP/Types/Method/Arbitrary.hs view
@@ -1,21 +1,21 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -{-|-Module : Network.HTTP.Types.Method.Arbitrary-Description : Arbitrary Instances for Network.HTTP.Types.Method-Copyright : (c) Alex Brandt, 2018-License : MIT--Arbitrary instances for "Network.HTTP.Types.Method".--}-module Network.HTTP.Types.Method.Arbitrary- ()-where+-- |+-- Module : Network.HTTP.Types.Method.Arbitrary+-- Description : Arbitrary Instances for Network.HTTP.Types.Method+-- Copyright : (c) Alex Brandt, 2018+-- License : MIT+--+-- Arbitrary instances for "Network.HTTP.Types.Method".+module Network.HTTP.Types.Method.Arbitrary () where -import Network.HTTP.Types.Method ( StdMethod(..) )-import Test.QuickCheck ( Arbitrary(arbitrary)- , elements- )+import Network.HTTP.Types.Method+ ( StdMethod (..),+ )+import Test.QuickCheck+ ( Arbitrary (arbitrary),+ elements,+ ) instance Arbitrary StdMethod where arbitrary =
src/Network/URI/Arbitrary.hs view
@@ -1,77 +1,82 @@ {-# LANGUAGE RecordWildCards #-}-+{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -{-|-Module : Network.URI.Arbitrary-Description : Arbitrary Instances for Network.URI-Copyright : (c) Alex Brandt, 2018-License : MIT+{-# HLINT ignore "Evaluate" #-} -Arbitrary instances for "Network.URI".--}-module Network.URI.Arbitrary- ()-where+-- |+-- Module : Network.URI.Arbitrary+-- Description : Arbitrary Instances for Network.URI+-- Copyright : (c) Alex Brandt, 2018+-- License : MIT+--+-- Arbitrary instances for "Network.URI".+module Network.URI.Arbitrary () where -import Control.Applicative ( (<$>)- , (<*>)- )-import Control.Monad ( replicateM )-import Data.List ( intercalate )-import Network.URI ( parseURIReference- , URI(..)- , URIAuth(..)- , uriToString- )-import Test.QuickCheck ( Arbitrary(arbitrary, shrink)- , choose- , elements- , Gen- , listOf- , listOf1- , oneof- , suchThat- )+import Control.Monad+ ( replicateM,+ )+import Data.List+ ( intercalate,+ )+import Network.URI+ ( URI (..),+ URIAuth (..),+ parseURIReference,+ uriToString,+ )+import Test.QuickCheck+ ( Arbitrary (arbitrary, shrink),+ Gen,+ choose,+ elements,+ listOf,+ listOf1,+ oneof,+ suchThat,+ ) instance Arbitrary URI where arbitrary = do- uriScheme <- scheme+ uriScheme <- oneof [return "", scheme] uriAuthority <- arbitrary :: Gen (Maybe URIAuth) uriPath <- path (null uriScheme) $ maybe True emptyAuthority uriAuthority- uriQuery <- oneof [query, return ""]- uriFragment <- oneof [fragment, return ""]-- return URI { .. }- where- emptyAuthority URIAuth {..} = all null [uriUserInfo, uriRegName, uriPort]+ uriQuery <- oneof [query, return ""]+ uriFragment <- oneof [fragment, return ""] - shrink URI {..} = filter- isURI- [ URI uriScheme' uriAuthority' uriPath' uriQuery' uriFragment'- | (uriScheme', uriAuthority', uriPath', uriQuery', uriFragment') <- shrink- (uriScheme, uriAuthority, uriPath, uriQuery, uriFragment)- ]- where- isURI u = case parseURIReference (uriToString id u "") of- Just u' -> u' == u- Nothing -> False+ return URI {..}+ where+ emptyAuthority URIAuth {..} = all null [uriUserInfo, uriRegName, uriPort] + shrink URI {..} =+ filter+ isURI+ [ URI uriScheme' uriAuthority' uriPath' uriQuery' uriFragment'+ | (uriScheme', uriAuthority', uriPath', uriQuery', uriFragment') <-+ shrink+ (uriScheme, uriAuthority, uriPath, uriQuery, uriFragment)+ ]+ where+ isURI u = case parseURIReference (uriToString id u "") of+ Just u' -> u' == u+ Nothing -> False instance Arbitrary URIAuth where arbitrary = URIAuth <$> userinfo <*> host `suchThat` (not . null) <*> port shrink URIAuth {..} = [ URIAuth uriUserInfo' uriRegName' uriPort'- | (uriUserInfo', uriRegName', uriPort') <- shrink- (uriUserInfo, uriRegName, uriPort)+ | (uriUserInfo', uriRegName', uriPort') <-+ shrink+ (uriUserInfo, uriRegName, uriPort) ] -- * RFC 3986 Generators+ ----- Some generators are handled by the 'Arbitrary' instances above, and others--- are folded into symbols that are preceeded or followed by identifying--- tokens.+-- Some generators are handled by the 'Arbitrary' instances above, and+-- others are folded into symbols that are preceded or followed by+-- identifying tokens. scheme :: Gen String scheme = do@@ -83,9 +88,11 @@ userinfo = do u <- concat <$> userinfo' if null u then return "" else return $ u ++ "@"- where- userinfo' = listOf $ oneof- [replicateM 1 $ oneof [unreserved, subDelims, return ':'], percentEncoded]+ where+ userinfo' =+ listOf $+ oneof+ [replicateM 1 $ oneof [unreserved, subDelims, return ':'], percentEncoded] host :: Gen String host = oneof [ipLiteral, ipv4Address, regName]@@ -97,9 +104,11 @@ ipLiteral :: Gen String ipLiteral = do- x <- oneof [ipv6Address- --, ipvFuture- ]+ x <-+ oneof+ [ ipv6Address+ -- , ipvFuture+ ] return $ "[" ++ x ++ "]" {- TODO Check that "Network.URI" implements this correctly.@@ -111,18 +120,21 @@ -} ipv6Address :: Gen String-ipv6Address = concat <$> oneof- [ sequence [b 6, ls32]- , sequence [return "::", b 5, ls32]- , sequence [h16, return "::", b 4, ls32]- , sequence [b 1, h16, return "::", b 3, ls32]- , sequence [b 2, h16, return "::", b 2, ls32]- , sequence [b 3, h16, return "::", b 1, ls32]- , sequence [b 4, h16, return "::", ls32]- , sequence [b 5, h16, return "::", h16]- , sequence [b 6, h16, return "::"]- ]- where b n = fmap concat $ replicateM n $ fmap (++ ":") h16 :: Gen String+ipv6Address =+ concat+ <$> oneof+ [ sequence [b 6, ls32],+ sequence [return "::", b 5, ls32],+ sequence [h16, return "::", b 4, ls32],+ sequence [b 1, h16, return "::", b 3, ls32],+ sequence [b 2, h16, return "::", b 2, ls32],+ sequence [b 3, h16, return "::", b 1, ls32],+ sequence [b 4, h16, return "::", ls32],+ sequence [b 5, h16, return "::", h16],+ sequence [b 6, h16, return "::"]+ ]+ where+ b n = fmap concat $ replicateM n $ fmap (++ ":") h16 :: Gen String h16 :: Gen String h16 = replicateM 4 hexdig@@ -137,17 +149,22 @@ decOctet = (show :: Int -> String) <$> choose (0, 255) regName :: Gen String-regName = fmap concat $ listOf $ oneof- [replicateM 1 unreserved, percentEncoded, replicateM 1 subDelims]+regName =+ fmap concat $+ listOf $+ oneof+ [replicateM 1 unreserved, percentEncoded, replicateM 1 subDelims] path :: Bool -> Bool -> Gen String-path emptyScheme emptyURIAuth = if emptyURIAuth- then oneof- [ pathAbsolute- , if emptyScheme then pathNoScheme else pathRootless- , return ""- ]- else pathAbEmpty+path emptyScheme emptyURIAuth =+ if emptyURIAuth+ then+ oneof+ [ pathAbsolute,+ if emptyScheme then pathNoScheme else pathRootless,+ return ""+ ]+ else pathAbEmpty pathAbEmpty :: Gen String pathAbEmpty = concat <$> listOf (('/' :) . concat <$> listOf pchar)@@ -162,21 +179,23 @@ pathRootless = concat <$> sequence [concat <$> listOf1 pchar, pathAbEmpty] segment1nc :: Gen String-segment1nc = oneof- [ replicateM 1 unreserved- , percentEncoded- , replicateM 1 subDelims- , replicateM 1 $ return '@'- ]+segment1nc =+ oneof+ [ replicateM 1 unreserved,+ percentEncoded,+ replicateM 1 subDelims,+ replicateM 1 $ return '@'+ ] pchar :: Gen String-pchar = oneof- [ replicateM 1 unreserved- , percentEncoded- , replicateM 1 subDelims- , replicateM 1 $ return ':'- , replicateM 1 $ return '@'- ]+pchar =+ oneof+ [ replicateM 1 unreserved,+ percentEncoded,+ replicateM 1 subDelims,+ replicateM 1 $ return ':',+ replicateM 1 $ return '@'+ ] query :: Gen String query =
test/Network/HTTP/Media/MediaType/ArbitrarySpec.hs view
@@ -1,32 +1,38 @@-{-|-Module : Network.HTTP.Media.MediaType.ArbitrarySpec-Description : Tests for Network.HTTP.Media.MediaType.Arbitrary-Copyright : (c) Alex Brandt, 2018-License : MIT--Tests for "Network.HTTP.Media.MediaType.Arbitrary".--}+-- |+-- Module : Network.HTTP.Media.MediaType.ArbitrarySpec+-- Description : Tests for Network.HTTP.Media.MediaType.Arbitrary+-- Copyright : (c) Alex Brandt, 2018+-- License : MIT+--+-- Tests for "Network.HTTP.Media.MediaType.Arbitrary". module Network.HTTP.Media.MediaType.ArbitrarySpec- ( main- , spec+ ( main,+ spec, ) where -import Prelude hiding ( null )--import Data.ByteString ( null )-import Data.CaseInsensitive ( original )-import Network.HTTP.Media.MediaType ( mainType- , subType- )-import Test.Hspec ( describe- , hspec- , Spec- )-import Test.Hspec.QuickCheck ( prop )--import Network.HTTP.Media.MediaType.Arbitrary- ( )+import Data.ByteString+ ( null,+ )+import Data.CaseInsensitive+ ( original,+ )+import Network.HTTP.Media.MediaType+ ( mainType,+ subType,+ )+import Network.HTTP.Media.MediaType.Arbitrary ()+import Test.Hspec+ ( Spec,+ describe,+ hspec,+ )+import Test.Hspec.QuickCheck+ ( prop,+ )+import Prelude hiding+ ( null,+ ) main :: IO () main = hspec spec
test/Network/HTTP/Types/Method/ArbitrarySpec.hs view
@@ -1,37 +1,40 @@-{-|-Module : Network.HTTP.Types.Method.ArbitrarySpec-Description : Tests for Network.HTTP.Types.Method.Arbitrary-Copyright : (c) Alex Brandt, 2018-License : MIT--Tests for "Network.HTTP.Types.Method.Arbitrary".--}+-- |+-- Module : Network.HTTP.Types.Method.ArbitrarySpec+-- Description : Tests for Network.HTTP.Types.Method.Arbitrary+-- Copyright : (c) Alex Brandt, 2018+-- License : MIT+--+-- Tests for "Network.HTTP.Types.Method.Arbitrary". module Network.HTTP.Types.Method.ArbitrarySpec- ( main- , spec+ ( main,+ spec, ) where -import Network.HTTP.Types.Method ( parseMethod- , renderStdMethod- )-import Test.Hspec ( describe- , hspec- , Spec- )-import Test.Hspec.QuickCheck ( prop )-import Test.Invariant ( (<=>) )--import Network.HTTP.Types.Method.Arbitrary- ( )+import Network.HTTP.Types.Method+ ( parseMethod,+ renderStdMethod,+ )+import Network.HTTP.Types.Method.Arbitrary ()+import Test.Hspec+ ( Spec,+ describe,+ hspec,+ )+import Test.Hspec.QuickCheck+ ( prop,+ )+import Test.Invariant+ ( (<=>),+ ) main :: IO () main = hspec spec spec :: Spec spec =- describe "properties"- $ prop "parseMethod . renderStdMethod <=> Right"- $ parseMethod- . renderStdMethod- <=> Right+ describe "properties" $+ prop "parseMethod . renderStdMethod <=> Right" $+ parseMethod+ . renderStdMethod+ <=> Right
test/Network/URI/ArbitrarySpec.hs view
@@ -1,36 +1,38 @@-{-|-Module : Network.URI.ArbitrarySpec-Description : Tests for Network.URI.Arbitrary-Copyright : (c) Alex Brandt, 2018-License : MIT--Tests for "Network.URI.Arbitrary".--}+-- |+-- Module : Network.URI.ArbitrarySpec+-- Description : Tests for Network.URI.Arbitrary+-- Copyright : (c) Alex Brandt, 2018+-- License : MIT+--+-- Tests for "Network.URI.Arbitrary". module Network.URI.ArbitrarySpec- ( main- , spec+ ( main,+ spec, ) where -import Network.URI ( isURIReference- , parseURIReference- , uriToString- )-import Test.Hspec ( describe- , hspec- , Spec- )-import Test.Hspec.QuickCheck ( prop )--import Network.URI.Arbitrary ( )+import Network.URI+ ( isURIReference,+ parseURIReference,+ uriToString,+ )+import Network.URI.Arbitrary ()+import Test.Hspec+ ( Spec,+ describe,+ hspec,+ )+import Test.Hspec.QuickCheck+ ( prop,+ ) main :: IO () main = hspec spec spec :: Spec spec = describe "properties" $ do- prop "isURIReference (uriToString id u \"\")"- $ \u -> isURIReference (uriToString id u "")+ prop "isURIReference (uriToString id u \"\")" $+ \u -> isURIReference (uriToString id u "") - prop "Just u == parseURIReference (uriToString id u \"\")"- $ \u -> Just u == parseURIReference (uriToString id u "")+ prop "Just u == parseURIReference (uriToString id u \"\")" $+ \u -> Just u == parseURIReference (uriToString id u "")