Commit 8fc19d69 authored by Clint Adams's avatar Clint Adams
Browse files

hackage-security: force JSON strings to ASCII in property testing

parent 4bb713f3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
haskell-hackage-security (0.5.3.0-5) unstable; urgency=medium

  * Force JSON strings to ASCII in property testing.

 -- Clint Adams <clint@debian.org>  Sun, 15 Apr 2018 18:04:40 -0400

haskell-hackage-security (0.5.3.0-4) unstable; urgency=medium

  * Fix Build-Depends.
+18 −0
Original line number Diff line number Diff line
@@ -17,3 +17,21 @@
 
   hs-source-dirs:      tests
   default-language:    Haskell2010
--- a/tests/TestSuite/JSON.hs
+++ b/tests/TestSuite/JSON.hs
@@ -46,12 +46,13 @@
       [ (1, pure JSNull)
       , (1, JSBool   <$> arbitrary)
       , (2, JSNum    <$> arbitrary)
-      , (2, JSString <$> arbitrary)
+      , (2, JSString . getASCIIString <$> arbitrary)
       , (3, JSArray                <$> resize (sz `div` 2) arbitrary)
-      , (3, JSObject . noDupFields <$> resize (sz `div` 2) arbitrary)
+      , (3, JSObject . noDupFields . asciify <$> resize (sz `div` 2) arbitrary)
       ]
     where
       noDupFields = nubBy (\(x,_) (y,_) -> x==y)
+      asciify = map (\(x,y) -> (getASCIIString x, y))
 
   shrink JSNull        = []
   shrink (JSBool    _) = []