git.iko.soy/typeable/attoparsec
on master help sign in
Test the ensure combinator.
commita3b276b50d2aa7c7b87da93d0569b6ec000477db authorBryan O'Sullivan <bos@serpentine.com> dateTue 9 Mar 2010, 12:26 (17 years ago) parentd8c6591
1 file changed+6−1
tests/QC.hs+6−1
tests/QC.hs+6−1
@@ -81,6 +81,10 @@ takeTill (w, s) =
8181 P.Done t' h' -> t == t' && h == h'
8282 _ -> False
8383
84+ensure n s = case defP (P.ensure n) s of
85+ P.Done _ () -> B.length s >= n
86+ _ -> B.length s < n
87+
8488takeWhile1_empty = maybeP (P.takeWhile1 undefined) B.empty == Nothing
8589
8690endOfInput s = maybeP P.endOfInput s == if B.null s
@@ -104,6 +108,7 @@ tests = [
104108 testProperty "takeWhile1" takeWhile1,
105109 testProperty "takeWhile1_empty" takeWhile1_empty,
106110 testProperty "takeTill" takeTill,
107− testProperty "endOfInput" endOfInput
111+ testProperty "endOfInput" endOfInput,
112+ testProperty "ensure" ensure
108113 ]
109114 ]