]> code.delx.au - offlineimap/commitdiff
Added astring_basic test
authorJohn Goerzen <jgoerzen@complete.org>
Tue, 12 Aug 2008 05:55:31 +0000 (00:55 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Tue, 12 Aug 2008 05:55:31 +0000 (00:55 -0500)
testsrc/TestParserPrim.hs

index d20a359ad746b0417c315df7d49c16468f62d93b..89ba11e07be7ea945eb5cd02c5c80d841b930834 100644 (file)
@@ -68,8 +68,19 @@ prop_atom s =
                     else Nothing
     where isvalid = not (null s) && all (`notElem` atomSpecials) s
 
+prop_astring_basic :: String -> Result
+prop_astring_basic s =
+    p astring s @?= if isvalid
+                       then Just s
+                       else Nothing
+    where isvalid = not (null s) && all isValidChar s
+          isValidChar c =
+              c `notElem` atomSpecials ||
+              c `elem` respSpecials
+
 allt = [q "quoted" prop_quoted,
         q "literal" prop_literal,
         q "string3501" prop_string3501,
-        q "atom" prop_atom
+        q "atom" prop_atom,
+        q "astring basic" prop_astring_basic
        ]