expectLeftString :: Either String a -> Bool expectLeftString (Left _) = True expectLeftString _ = False makeBoolParseError :: String -> Assertion makeBoolParseError s = assertBool ("'"++s++"' returns error") (expectLeftString (getCommand s))This gets used in the test creation like this:
"parseL3 " ~: makeBoolParseError "load"
For the positive cases, however, it becomes quite a bit messier. For example:
"parseL2aSpace " ~: "'load /x/xxx addint.qpo' returns QCLoad" ~: Right (QCLoad "/a/bc with space.qpo") @=? (getCommand "load /a/bc with space.qpo")
Multiple lines of this become rather difficult to parse.
One solution would be to create a helper function for creating the positive assertions as well. I'll give that a shot and see how it looks!