From 1aa1358690388738fc102c6f319cb2f4a1f860b3 Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Mon, 11 Aug 2008 23:44:43 -0500 Subject: [PATCH] Added prop_rfr_basic --- testsrc/TestParser.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/testsrc/TestParser.hs b/testsrc/TestParser.hs index 1ccc3f1..1bda21f 100644 --- a/testsrc/TestParser.hs +++ b/testsrc/TestParser.hs @@ -50,6 +50,24 @@ prop_getFullLine_count s = expectedResult = braceString ++ "\r\n" ++ (s !! 1) expectedRemain = expectedString (drop 2 s) +prop_rfr_basic :: [String] -> Property +prop_rfr_basic s = + let testlist = + case length s of + 0 -> [] + 1 -> ["TAG " ++ head s] + _ -> map ("* " ++) (init s) ++ + ["TAG " ++ last s] + resultstr = expectedString testlist + in noCR s && noBrace s ==> + runLinesConnection testlist readFullResponse @?= + if null s + then Left "EOF in input in readLine" + else Right (resultstr, ([], [])) + +noBrace s = and (map (not . isSuffixOf "}") s) + allt = [q "getFullLine_basic" prop_getFullLine_basic, - q "getFullLine_count" prop_getFullLine_count + q "getFullLine_count" prop_getFullLine_count, + q "readFullResponse_basic" prop_rfr_basic ] -- 2.39.2