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

testsrc/TestParser.hs

index 69a6bfb684c405e6b20239b0f7655c01b28618de..86bb090f6f32664b2252e545ae7338266cc9e101 100644 (file)
@@ -82,10 +82,18 @@ prop_respTextAtom s2 =
       Just (RespText (Just s2) s1)
     where s1 = reverse s2 -- Gen manually to avoid test exhaustion
           
+prop_respTextAtomOpt :: String -> String -> String -> Property
+prop_respTextAtomOpt codeatom codedesc text =
+    isValidAtom codeatom && isValidText codedesc && isValidText text &&
+                ']' `notElem` (codeatom ++ codedesc) &&
+                (head text) /= '[' ==>
+    p respText ("[" ++ codeatom ++ " " ++ codedesc ++ "] " ++ text) @?=
+      Just (RespText (Just (codeatom ++ " " ++ codedesc)) text)
 
 allt = [q "getFullLine_basic" prop_getFullLine_basic,
         q "getFullLine_count" prop_getFullLine_count,
         q "readFullResponse_basic" prop_rfr_basic,
         q "respText simple" prop_respTextSimple,
-        q "respText atom" prop_respTextAtom
+        q "respText atom" prop_respTextAtom,
+        q "respTextAtomOpt" prop_respTextAtomOpt
        ]