git.iko.soy/typeable/attoparsec
on master help sign in
Strip trailing whitespace :-(
commited89e189ea0d786eeeb18e28e15333a374b31c64 authorBryan O'Sullivan <bos@serpentine.com> dateThu 11 Dec 2014, 11:24 (12 years ago) parenta6913c1
4 files changed+10−9
attoparsec.cabal+1 tests/QC/ByteString.hs+2−2 tests/QC/Common.hs+3−3 tests/QC/Text.hs+4−4
attoparsec.cabal+1
@@ -100,6 +100,7 @@ test-suite tests
100100 bytestring,
101101 deepseq >= 1.1,
102102 QuickCheck >= 2.7,
103+ quickcheck-unicode,
103104 scientific,
104105 test-framework >= 0.8.0.2,
105106 test-framework-quickcheck2 >= 0.3.0.3,
tests/QC/ByteString.hs+2−2
@@ -131,11 +131,11 @@ scan :: L.ByteString -> Positive Int64 -> Property
131131scan s (Positive k) = parseBS p s === Just (toStrictBS $ L.take k s)
132132 where p = P.scan k $ \ n _ ->
133133 if n > 0 then let !n' = n - 1 in Just n' else Nothing
134−
134+
135135members :: [Word8] -> Property
136136members s = property $ all (`S.memberWord8` set) s
137137 where set = S.fromList s
138−
138+
139139nonmembers :: [Word8] -> [Word8] -> Property
140140nonmembers s s' = property . not . any (`S.memberWord8` set) $ filter (not . (`elem` s)) s'
141141 where set = S.fromList s
tests/QC/Common.hs+3−3
@@ -54,15 +54,15 @@ repackBS_ = go . cycle
5454 | otherwise = let (h,t) = B.splitAt b s
5555 in h : go bs t
5656 go _ _ = error "unpossible"
57−
58−
57+
58+
5959newtype Unicode = Unicode {fromUnicode :: Char}
6060
6161valid :: Unicode -> Bool
6262valid (Unicode c) = c < '\55296' || '\57343' < c
6363
6464instance Arbitrary Unicode where
65− arbitrary = fmap Unicode (oneof [arbitrary, arbitraryBoundedEnum]) `suchThat` valid
65+ arbitrary = fmap Unicode (oneof [arbitrary, arbitraryBoundedEnum]) `suchThat` valid
6666 shrink = filter valid . map (Unicode . toEnum) . shrink . fromEnum . fromUnicode
6767
6868packUnicode :: [Unicode] -> T.Text
tests/QC/Text.hs+4−4
@@ -110,7 +110,7 @@ takeWhile w s =
110110
111111takeWhile1 :: Char -> L.Text -> Property
112112takeWhile1 w s =
113− let s' = L.cons w s
113+ let s' = L.cons w s
114114 (h,t) = L.span (<=w) s'
115115 in case PL.parse (P.takeWhile1 (<=w)) s' of
116116 PL.Done t' h' -> t === t' .&&. toStrict h === h'
@@ -143,15 +143,15 @@ scan :: L.Text -> Positive Int64 -> Property
143143scan s (Positive k) = parseT p s === Just (toStrict $ L.take k s)
144144 where p = P.scan k $ \ n _ ->
145145 if n > 0 then let !n' = n - 1 in Just n' else Nothing
146−
146+
147147members :: String -> Property
148148members s = property $ all (`S.member` set) s
149149 where set = S.fromList s
150−
150+
151151nonmembers :: String -> String -> Property
152152nonmembers s s' = property . not . any (`S.member` set) $ filter (not . (`elem` s)) s'
153153 where set = S.fromList s
154−
154+
155155tests :: [Test]
156156tests = [
157157 testProperty "anyChar" anyChar