git.iko.soy/typeable/attoparsec
on master help sign in
Fix up an errant test.
commit66ab088aba135fdf9517ff135510ee8847b4fbbc authorBryan O'Sullivan <bos@serpentine.com> dateThu 4 Mar 2010, 21:57 (17 years ago) parent25fb8a4
2 files changed+10−4
tests/Makefile+4−1 tests/QC.hs+6−3
tests/Makefile+4−1
@@ -1,9 +1,12 @@
1−all: TestFastSet.out QC.out
1+all: TestFastSet.out qc.out
22
33%.out: %.exe
44 ./$< | tee $<.tmp
55 mv $<.tmp $@
66
7+qc.exe: QC.hs
8+ ghc -O -fno-warn-orphans --make -o $@ $<
9+
710%.exe: %.hs
811 ghc -O -fno-warn-orphans --make -o $@ $<
912
tests/QC.hs+6−3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE OverloadedStrings #-}
12module Main (main) where
23
34import Control.Monad (forM_)
@@ -10,6 +11,7 @@ import Test.Framework.Providers.QuickCheck2 (testProperty)
1011import Test.QuickCheck hiding (NonEmpty)
1112import qualified Data.Attoparsec as P
1213import qualified Data.ByteString as B
14+import qualified Data.ByteString.Char8 as C
1315
1416-- Make sure that structures whose types claim they are non-empty
1517-- really are.
@@ -63,9 +65,10 @@ takeWhile (w,s) =
6365 P.Done t' h' -> t == t' && h == h'
6466 _ -> False
6567
66−takeWhile1 (w, NonEmpty s) =
67− let (h,t) = B.span (==w) s
68− in case defP (P.takeWhile1 (==w)) s of
68+takeWhile1 (w, s) =
69+ let s' = B.cons w s
70+ (h,t) = B.span (<=w) s'
71+ in case defP (P.takeWhile1 (<=w)) s' of
6972 P.Done t' h' -> t == t' && h == h'
7073 _ -> False
7174