@@ -95,17 +95,18 @@ testCodecsEncodeDecode :: TestTree
95
95
testCodecsEncodeDecode = testGroup " Codecs property 'encode . decode = id'"
96
96
[ mkCodecTest " bool" PGT. bool PE. bool PD. bool
97
97
, mkCodecTest " bytea" PGT. bytea PE. bytea PD. bytea
98
- , mkCodecTest " char" PGT. char PE. char PD. char
98
+ , mkCodecTest " char" PGT. char (PE. char . unAsciiChar)
99
+ (fmap AsciiChar <$> PD. char)
99
100
, mkCodecTest " date" PGT. date PE. date PD. date
100
101
, mkCodecTest " float4" PGT. float4 PE. float4 PD. float4
101
102
, mkCodecTest " float8" PGT. float8 PE. float8 PD. float8
102
103
, mkCodecTest " int2" PGT. int2 PE. int2 PD. int2
103
104
, mkCodecTest " int4" PGT. int4 PE. int4 PD. int4
104
105
, mkCodecTest " int8" PGT. int8 PE. int8 PD. int8
105
106
, mkCodecTest " interval" PGT. interval PE. interval PD. interval
106
- , mkCodecTest " json" PGT. json (PE. bsJsonText . unJsonString )
107
+ , mkCodecTest " json" PGT. json (PE. bsJsonText . unJsonString)
107
108
(fmap JsonString <$> PD. bsJsonText)
108
- , mkCodecTest " jsonb" PGT. jsonb (PE. bsJsonBytes . unJsonString)
109
+ , mkCodecTest " jsonb" PGT. jsonb (PE. bsJsonBytes . unJsonString)
109
110
(fmap JsonString <$> PD. bsJsonBytes)
110
111
, mkCodecTest " numeric" PGT. numeric PE. numeric PD. numeric
111
112
, mkCodecTest " text" PGT. text PE. bsText PD. bsText
@@ -145,6 +146,12 @@ testCodecsEncodePrint = testGroup
145
146
-- Orphan instances
146
147
--
147
148
149
+ newtype AsciiChar = AsciiChar { unAsciiChar :: Char }
150
+ deriving (Show , Eq )
151
+
152
+ instance Arbitrary AsciiChar where
153
+ arbitrary = AsciiChar <$> choose ('\ 0 ', '\ 127 ')
154
+
148
155
-- Helper to generate valid json strings
149
156
newtype JsonString = JsonString { unJsonString :: B. ByteString }
150
157
deriving (Show , Eq , IsString )
0 commit comments