@@ -6,6 +6,7 @@ import Control.Applicative ((<$>), (<*>))
66import Prelude hiding (takeWhile)
77import Test.Framework.Providers.QuickCheck2 (testProperty)
88import Test.QuickCheck
9+import qualified Data.Char as Char
910import qualified Data.Attoparsec.Text as P
1011import qualified Data.Attoparsec.Text.Lazy as PL
1112import qualified Data.Text as T
@@ -59,6 +60,15 @@ string s t = maybeP (P.string s') (s `L.append` t) == Just s'
5960stringCI s = P.parseOnly (P.stringCI fs) s == Right s
6061 where fs = T.toCaseFold s
6162
63+asciiCI x =
64+ (\s i -> P.parseOnly (P.asciiCI s) i == Right i)
65+ <$> maybeModifyCase x
66+ <*> maybeModifyCase x
67+ where
68+ maybeModifyCase s = elements [s, toLower s, toUpper s]
69+ toLower = T.map (\c -> if c < Char.chr 127 then Char.toLower c else c)
70+ toUpper = T.map (\c -> if c < Char.chr 127 then Char.toUpper c else c)
71+
6272toStrict = T.concat . L.toChunks
6373
6474skipWhile w s =
@@ -105,6 +115,7 @@ tests = [
105115 testProperty "peekChar" peekChar,
106116 testProperty "string" string,
107117 testProperty "stringCI" stringCI,
118+ testProperty "asciiCI" asciiCI,
108119 testProperty "skipWhile" skipWhile,
109120 testProperty "takeCount" takeCount,
110121 testProperty "takeWhile" takeWhile,