Skip to content

Commit

Permalink
do not use Data.Either.isLeft to support base <4.7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
msakai committed Jun 21, 2015
1 parent 8fade4f commit d9d1efa
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/TestPBFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ case_normalized_opt_market_split_4_30_2 = checkOPBFile "test/samples/normalized-
case_pigeonhole_5_4 = checkOPBFile "test/samples/pigeonhole_5_4.opb"

case_trailing_junk = do
isLeft (parseOPBString "" trailingJunk) @?= True
isLeft (parseOPBByteString "" (BSChar8.pack trailingJunk)) @?= True
isLeft (A.parseOPBByteString (BSChar8.pack trailingJunk)) @?= True
isError (parseOPBString "" trailingJunk) @?= True
isError (parseOPBByteString "" (BSChar8.pack trailingJunk)) @?= True
isError (A.parseOPBByteString (BSChar8.pack trailingJunk)) @?= True
where
-- isLeft is available only on base >=4.7.0.0.
isError :: Either a b -> Bool
isError (Left _) = True
isError (Right _) = False

trailingJunk = unlines
[ "* #variable= 5 #constraint= 4"
, "*"
Expand Down

0 comments on commit d9d1efa

Please sign in to comment.