From: John Goerzen Date: Tue, 12 Aug 2008 08:08:08 +0000 (-0500) Subject: respText stuff is working X-Git-Url: https://code.delx.au/offlineimap/commitdiff_plain/82cf5be10bb0a98aaa71aa88bfd77f7989337e2f respText stuff is working all tests pass --- diff --git a/src/Network/IMAP/Parser.hs b/src/Network/IMAP/Parser.hs index e945d5e..9f910c5 100644 --- a/src/Network/IMAP/Parser.hs +++ b/src/Network/IMAP/Parser.hs @@ -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 diff --git a/testsrc/TestParser.hs b/testsrc/TestParser.hs index 704d656..69a6bfb 100644 --- a/testsrc/TestParser.hs +++ b/testsrc/TestParser.hs @@ -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