Commit a201d86e authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Update test-suite to use latest HUnit

Closes #68
parent fede803e
......@@ -103,9 +103,9 @@ test-suite parsec
mtl,
parsec,
-- dependencies whose version bounds are not inherited via lib:parsec
HUnit >= 1.2 && < 1.4,
test-framework >= 0.6 && < 0.9,
test-framework-hunit >= 0.2 && < 0.4
HUnit == 1.6.*,
test-framework == 0.8.*,
test-framework-hunit == 0.3.*
default-language: Haskell2010
......
module Bugs.Bug9 ( main ) where
import Control.Applicative ((<*), (<$>), (<$))
import Text.Parsec
import Text.Parsec.Language (haskellStyle)
import Text.Parsec.String (Parser)
import Text.Parsec.Expr
import qualified Text.Parsec.Token as P
import Control.Applicative ((<$), (<$>), (<*))
import Text.Parsec
import Text.Parsec.Expr
import Text.Parsec.Language (haskellStyle)
import Text.Parsec.String (Parser)
import qualified Text.Parsec.Token as P
import Test.HUnit hiding ( Test )
import Test.Framework
import Test.Framework.Providers.HUnit
import Test.Framework
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test)
import Util
import Util
data Expr = Const Integer | Op Expr Expr
deriving Show
......@@ -42,5 +41,5 @@ parseExpr = buildExpressionParser table (Const <$> integer)
integer = P.integer lexer
reserved = P.reserved lexer
reservedOp = P.reservedOp lexer
_reservedOp = P.reservedOp lexer
module Features.Feature80 ( main ) where
module Features.Feature80
( main
) where
import Control.Applicative (pure)
import Control.Monad.Identity
import Data.List.NonEmpty
import Data.Semigroup
import Test.Framework
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test)
import Test.HUnit hiding ( Test )
import Test.Framework
import Test.Framework.Providers.HUnit
import Data.List.NonEmpty
import Data.Semigroup
import Control.Monad.Identity
import Control.Applicative (pure)
import Text.Parsec
import Text.Parsec
main :: Test
main =
......@@ -22,8 +19,8 @@ main =
parseString (sconcat $ fromList [as, mempty, bs]) "aabbb" @?= "aabbb"
parseString (mconcat [as, mempty, bs]) "aabbb" @?= "aabbb"
parseString (mempty :: ParsecT String () Identity String) "aabbb" @?= ""
parseString (stimes 2 str_a) "aabbb" @?= "aa"
parseFail (stimes 3 str_a) "aabbb" @?= "no parse"
parseString (stimes (2::Int) str_a) "aabbb" @?= "aa"
parseFail (stimes (3::Int) str_a) "aabbb" @?= "no parse"
parseString ((one ch_a) <> (one ch_a) <> bs) "aabbb" @?= "aabbb"
where
......@@ -41,11 +38,11 @@ main =
parseString :: ParsecT String () Identity String -> String -> String
parseString p input =
case parse p "Example" input of
Left{} -> error "Parse failure"
Left{} -> error "Parse failure"
Right str -> str
parseFail :: ParsecT String () Identity String -> String -> String
parseFail p input =
case parse p "Example" input of
Left{} -> "no parse"
Right _ -> error "Parsed but shouldn't"
Left{} -> "no parse"
Right _ -> error "Parsed but shouldn't"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment