]> code.delx.au - offlineimap/blobdiff - testsrc/TestParserPrim.hs
Added first respText test
[offlineimap] / testsrc / TestParserPrim.hs
index 8737c9318ab8ae78dcecdc4511ae4ed157fb72fd..ff016fb2d9467dca515d594c79d7976f1ff64d2b 100644 (file)
@@ -30,15 +30,6 @@ import TestInfrastructure
 import Text.ParserCombinators.Parsec
 import Text.ParserCombinators.Parsec.Error
 
-{- | Test a parser, forcing it to apply to all input. -}
-p parser input = 
-    case parse parseTest "(none)" input of
-      Left _ -> Nothing
-      Right y -> Just y
-    where parseTest = do r <- parser
-                         eof
-                         return r
-
 prop_quoted :: String -> Result
 prop_quoted s =
     p quoted (gen_quoted s) @?= Just s
@@ -90,10 +81,11 @@ prop_astring s useQuoted =
 
 prop_text :: String -> Result
 prop_text s =
-    p text s @=? if isValid
+    p text s @=? if isValidText s
                  then Just s
                  else Nothing
-    where isValid = not (null s) && all (`notElem` crlf) s
+
+isValidText s = not (null s) && all (`notElem` crlf) s
 
 prop_tag :: String -> Result
 prop_tag s =