X-Git-Url: https://code.delx.au/offlineimap/blobdiff_plain/9ccd884d0ee9699ac76f8f6b671c675ec83be207..2e7f49be62e55cb56d451bb72c4413b910ea003d:/testsrc/TestParserPrim.hs diff --git a/testsrc/TestParserPrim.hs b/testsrc/TestParserPrim.hs index 86046b4..49c4a32 100644 --- a/testsrc/TestParserPrim.hs +++ b/testsrc/TestParserPrim.hs @@ -36,11 +36,22 @@ p parser input = prop_quoted :: String -> Result prop_quoted s = - p quoted quotedString @?= Right s - where quotedString = '"' : concatMap quoteChar s ++ "\"" - quoteChar '\\' = "\\\\" + p quoted (gen_quoted s) @?= Right s + +gen_quoted :: String -> String +gen_quoted s = '"' : concatMap quoteChar s ++ "\"" + where quoteChar '\\' = "\\\\" quoteChar '"' = "\\\"" quoteChar x = [x] -allt = [q "quoted" prop_quoted +prop_literal :: String -> Result +prop_literal s = + p literal (gen_literal s) @?= Right s + +gen_literal :: String -> String +gen_literal s = + "{" ++ show (length s) ++ "}\r\n" ++ s + +allt = [q "quoted" prop_quoted, + q "literal" prop_literal ]