]> code.delx.au - offlineimap/commitdiff
Clean up tests and added respText atom test
authorJohn Goerzen <jgoerzen@complete.org>
Tue, 12 Aug 2008 07:57:44 +0000 (02:57 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Tue, 12 Aug 2008 07:57:44 +0000 (02:57 -0500)
testsrc/TestParser.hs
testsrc/TestParserPrim.hs

index 31290391c0a67925f5782feaa6316e12143debfe..704d65622db16caa23d74767a49af82ec118c1bf 100644 (file)
@@ -30,7 +30,7 @@ import Network.IMAP.Types
 
 import TestInfrastructure
 import TestConnection(expectedString, noCR)
-import TestParserPrim(isValidText)
+import TestParserPrim(isValidText, isValidAtom)
 
 prop_getFullLine_basic :: [String] -> Property
 prop_getFullLine_basic s =
@@ -71,12 +71,21 @@ noBrace s = and (map (not . isSuffixOf "}") s)
 prop_respTextSimple :: String -> Result
 prop_respTextSimple s =
     p respText s @?= 
-      if isValidText s
+      if isValidText s && (head s /= '[')
          then Just (RespText Nothing s)
          else Nothing
 
+prop_respTextAtom :: String -> Property
+prop_respTextAtom s2 =
+    isValidAtom s2 && isValidText s1 ==>
+    p respText ("[" ++ s2 ++ "] " ++ s1) @?=
+      Just (RespText (Just s2) s1)
+    where s1 = reverse s2 -- Gen manually to avoid test exhaustion
+          
+
 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 simple" prop_respTextSimple,
+        q "respText atom" prop_respTextAtom
        ]
index 29cbfc94a999fa5f4f25a26d3b6238d7a60808ad..65b42dcdf58bac163527d54f38686a03a6943c9d 100644 (file)
@@ -106,7 +106,7 @@ allt = [q "quoted" prop_quoted,
         q "string3501" prop_string3501,
         q "atom" prop_atom,
         q "astring basic" prop_astring_basic,
-        qverbose "astring basic thorough" prop_astring_basic_thorough,
+        q "astring basic thorough" prop_astring_basic_thorough,
         q "astring full" prop_astring,
         q "text" prop_text,
         q "tag" prop_tag