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

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

parent 4bb713f3
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.
......
......@@ -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 _) = []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment