@@ -95,17 +95,18 @@ testCodecsEncodeDecode :: TestTree
9595testCodecsEncodeDecode = testGroup " Codecs property 'encode . decode = id'"
9696 [ mkCodecTest " bool" PGT. bool PE. bool PD. bool
9797 , 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)
99100 , mkCodecTest " date" PGT. date PE. date PD. date
100101 , mkCodecTest " float4" PGT. float4 PE. float4 PD. float4
101102 , mkCodecTest " float8" PGT. float8 PE. float8 PD. float8
102103 , mkCodecTest " int2" PGT. int2 PE. int2 PD. int2
103104 , mkCodecTest " int4" PGT. int4 PE. int4 PD. int4
104105 , mkCodecTest " int8" PGT. int8 PE. int8 PD. int8
105106 , mkCodecTest " interval" PGT. interval PE. interval PD. interval
106- , mkCodecTest " json" PGT. json (PE. bsJsonText . unJsonString )
107+ , mkCodecTest " json" PGT. json (PE. bsJsonText . unJsonString)
107108 (fmap JsonString <$> PD. bsJsonText)
108- , mkCodecTest " jsonb" PGT. jsonb (PE. bsJsonBytes . unJsonString)
109+ , mkCodecTest " jsonb" PGT. jsonb (PE. bsJsonBytes . unJsonString)
109110 (fmap JsonString <$> PD. bsJsonBytes)
110111 , mkCodecTest " numeric" PGT. numeric PE. numeric PD. numeric
111112 , mkCodecTest " text" PGT. text PE. bsText PD. bsText
@@ -145,6 +146,12 @@ testCodecsEncodePrint = testGroup
145146-- Orphan instances
146147--
147148
149+ newtype AsciiChar = AsciiChar { unAsciiChar :: Char }
150+ deriving (Show , Eq )
151+
152+ instance Arbitrary AsciiChar where
153+ arbitrary = AsciiChar <$> choose ('\ 0 ', '\ 127 ')
154+
148155-- Helper to generate valid json strings
149156newtype JsonString = JsonString { unJsonString :: B. ByteString }
150157 deriving (Show , Eq , IsString )
0 commit comments