Skip to content

Commit 596163a

Browse files
authored
Merge pull request #801 from dfithian/const-tests
Add tests for Const
2 parents db188c8 + 073b7c0 commit 596163a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tests/PropertyKeys.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module PropertyKeys ( keysTests ) where
44

55
import Prelude.Compat
66

7+
import Control.Applicative (Const)
78
import Data.Time (Day, LocalTime, TimeOfDay, UTCTime)
89
import Data.Version (Version)
910
import Instances ()
@@ -37,4 +38,5 @@ keysTests =
3738
, testProperty "Version" $ roundTripKey (undefined :: Version)
3839
, testProperty "Lazy Text" $ roundTripKey (undefined :: LT.Text)
3940
, testProperty "UUID" $ roundTripKey UUID.nil
41+
, testProperty "Const Text" $ roundTripKey (undefined :: Const T.Text ())
4042
]

tests/UnitTests.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module UnitTests
2424

2525
import Prelude.Compat
2626

27+
import Control.Applicative (Const)
2728
import Control.Monad (forM, forM_)
2829
import Data.Aeson ((.=), (.:), (.:?), (.:!), FromJSON(..), FromJSONKeyFunction(..), FromJSONKey(..), ToJSON1(..), decode, eitherDecode, encode, fromJSON, genericParseJSON, genericToEncoding, genericToJSON, object, withObject, withEmbeddedJSON)
2930
import Data.Aeson.Internal (JSONPathElement(..), formatError)
@@ -346,6 +347,7 @@ fromJSONKeyAssertions =
346347

347348
#if __GLASGOW_HASKELL__ >= 710
348349
, assertIsCoerce' "MyText'" (fromJSONKey :: FromJSONKeyFunction MyText')
350+
, assertIsCoerce "Const Text" (fromJSONKey :: FromJSONKeyFunction (Const Text ()))
349351
#endif
350352
]
351353
where

0 commit comments

Comments
 (0)