b <- option "" (sp >> respTextCodeText)
char ']'
sp
- return (a ++ " " ++ b)
+ case b of
+ [] -> return a
+ _ -> return $ a ++ " " ++ b
respTextCodeText = many1 (noneOf (']' : crlf))
\ No newline at end of file
prop_respTextAtom :: String -> Property
prop_respTextAtom s2 =
- isValidAtom s2 && isValidText s1 ==>
+ isValidAtom s2 && isValidText s1 && ']' `notElem` s1 ==>
p respText ("[" ++ s2 ++ "] " ++ s1) @?=
Just (RespText (Just s2) s1)
where s1 = reverse s2 -- Gen manually to avoid test exhaustion