Skip to content

Commit

Permalink
Merge pull request #22 from space-vacuum/bump/compiles-with-ghc-9.4.2
Browse files Browse the repository at this point in the history
Bump base upper bounds to <4.18
  • Loading branch information
kana authored Oct 31, 2022
2 parents 3e02d92 + 4d74639 commit 2d71ea1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
6 changes: 3 additions & 3 deletions shower.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ library
Shower.Parser
Shower.Class
build-depends:
base >=4.10 && <4.16,
base >=4.10 && <4.18,
megaparsec,
pretty
hs-source-dirs: lib
Expand All @@ -38,7 +38,7 @@ library
executable shower
main-is: Main.hs
build-depends:
base >=4.10 && <4.16,
base >=4.10 && <4.18,
shower
hs-source-dirs: exe
default-language: Haskell2010
Expand All @@ -50,7 +50,7 @@ test-suite shower-tests
Property
type: exitcode-stdio-1.0
build-depends:
base >=4.10 && <4.16,
base >=4.10 && <4.18,
aeson,
tasty,
tasty-golden,
Expand Down
20 changes: 17 additions & 3 deletions tests/Property.hs
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}

module Property where

import qualified Data.Text as Text
import qualified Data.Vector as Vector
import qualified Data.HashMap.Strict as HashMap
import qualified Data.Aeson as Aeson
import qualified Data.ByteString.Lazy.UTF8 as UTF8

import Test.QuickCheck
import Test.Tasty
import Test.Tasty.QuickCheck

#if MIN_VERSION_aeson(2,0,0)
import qualified Data.Aeson.Key as Key
import qualified Data.Aeson.KeyMap as KeyMap
#else
import qualified Data.HashMap.Strict as HashMap
#endif

import Shower

-- | 'Aeson.Value' generator, stolen from @api-tools@.
genJSON :: Gen Aeson.Value
genJSON = sized $ \size -> oneof [
Aeson.Object . HashMap.fromList <$>
resize (size `div` 2) (listOf ((,) <$> (Text.pack <$> arbitrary) <*> genJSON)),
Aeson.Object . objectFromList <$>
resize (size `div` 2) (listOf ((,) <$> (keyFromText . Text.pack <$> arbitrary) <*> genJSON)),
Aeson.Array . Vector.fromList <$> resize (size `div` 2) (listOf genJSON),
Aeson.String . Text.pack <$> arbitrary,
Aeson.Number . fromInteger <$> arbitrary,
Aeson.Bool <$> arbitrary,
pure Aeson.Null ]
where
(objectFromList, keyFromText) =
#if MIN_VERSION_aeson(2,0,0)
(KeyMap.fromList, Key.fromText)
#else
(HashMap.fromList, id)
#endif

-- | Test that formatting always works on JSON and never changes it.
prop_JSON :: Property
Expand Down

0 comments on commit 2d71ea1

Please sign in to comment.