Apply brittany

pull/8/head
Lennart Spitzner 2017-01-31 18:42:37 +01:00
parent bc70eb07e8
commit 93611b9a1c
1 changed files with 37 additions and 27 deletions

View File

@ -42,8 +42,8 @@ main = do
hspec $ groups `forM_` \(groupname, tests) -> do
describe (Text.unpack groupname) $ tests `forM_` \(name, pend, inp) -> do
(if pend then before_ pending else id)
$ it (Text.unpack name) $ roundTripEqual inp
$ it (Text.unpack name)
$ roundTripEqual inp
where
-- this function might be implemented in a weirdly complex fashion; the
-- reason being that it was copied from a somewhat more complex variant.
@ -55,13 +55,22 @@ main = do
-- l -> error $ "first non-empty line must start with #test footest\n" ++ show l
-- )
-- $ fmap (groupBy grouperT)
fmap (\case
fmap
( \case
GroupLine g:grouprest ->
(,) g
$ fmap (\case
HeaderLine n:PendingLine:rest | Just rlines <- mapM extractNormal rest -> (n, True, Text.unlines rlines)
HeaderLine n:rest | Just rlines <- mapM extractNormal rest -> (n, False, Text.unlines rlines)
l -> error $ "first non-empty line must start with #test footest\n" ++ show l
$ fmap
( \case
HeaderLine n:PendingLine:rest | Just rlines <- mapM
extractNormal
rest ->
(n, True, Text.unlines rlines)
HeaderLine n:rest | Just rlines <- mapM extractNormal rest ->
(n, False, Text.unlines rlines)
l ->
error
$ "first non-empty line must start with #test footest\n"
++ show l
)
$ groupBy grouperT
$ filter (not . lineIsSpace)
@ -96,7 +105,8 @@ main = do
]
, [ CommentLine
| _ <- Parsec.many $ Parsec.oneOf " \t"
, _ <- Parsec.optional $ Parsec.string "##" <* many (Parsec.noneOf "\r\n")
, _ <-
Parsec.optional $ Parsec.string "##" <* many (Parsec.noneOf "\r\n")
, _ <- Parsec.eof
]
]