]> code.delx.au - offlineimap/commitdiff
respText stuff is working
authorJohn Goerzen <jgoerzen@complete.org>
Tue, 12 Aug 2008 08:08:08 +0000 (03:08 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Tue, 12 Aug 2008 08:08:08 +0000 (03:08 -0500)
all tests pass

src/Network/IMAP/Parser.hs
testsrc/TestParser.hs

index e945d5efad4d23b16a6649d1c1426a6945e2dc00..9f910c5bd50da50691b9aebf03a55e5b9c4465f5 100644 (file)
@@ -106,6 +106,8 @@ respText =
                  b <- option "" (sp >> respTextCodeText)
                  char ']'
                  sp
-                 return (a ++ " " ++ b)
+                 case b of
+                   [] -> return a
+                   _ -> return $ a ++ " " ++ b
           respTextCodeText = many1 (noneOf (']' : crlf))
                  
\ No newline at end of file
index 704d65622db16caa23d74767a49af82ec118c1bf..69a6bfb684c405e6b20239b0f7655c01b28618de 100644 (file)
@@ -77,7 +77,7 @@ prop_respTextSimple s =
 
 prop_respTextAtom :: String -> Property
 prop_respTextAtom s2 =
-    isValidAtom s2 && isValidText s1 ==>
+    isValidAtom s2 && isValidText s1 && ']' `notElem` s1 ==>
     p respText ("[" ++ s2 ++ "] " ++ s1) @?=
       Just (RespText (Just s2) s1)
     where s1 = reverse s2 -- Gen manually to avoid test exhaustion