mirror of
https://github.com/Avi-D-coder/implicit-hie.git
synced 2024-11-26 00:04:23 +03:00
Fix handling empty lists
This commit is contained in:
parent
ea512066e5
commit
42d585560a
@ -105,12 +105,12 @@ optSkipToNextLine i = do
|
||||
peekChar >>= \case
|
||||
Just c
|
||||
| isEndOfLine c ->
|
||||
endOfLine *> indent i $> ()
|
||||
endOfLine >> indent i $> ()
|
||||
_ -> pure ()
|
||||
|
||||
-- | Comma or space separated list, with optional new lines.
|
||||
parseList :: Indent -> Parser [Text]
|
||||
parseList i = sepBy parseString (optSkipToNextLine i *> skipMany (char ',') *> optSkipToNextLine i)
|
||||
parseList i = sepBy parseString (optSkipToNextLine i >> skipMany (char ',') >> optSkipToNextLine i) <|> pure []
|
||||
|
||||
pathMain :: Indent -> [Text] -> Text -> [Text] -> [Text] -> Parser [Text]
|
||||
pathMain i p m o a =
|
||||
|
@ -116,6 +116,14 @@ spec = do
|
||||
Comp Exe "gen-hie" "app/Hie/Executable/Helper.hs",
|
||||
Comp Exe "gen-hie" "app/Hie/Executable/Utils.hs"
|
||||
]
|
||||
describe "Should Succeed" $
|
||||
it "succesfully parses single other-modules" $
|
||||
("other-modules: test\ndefault-language: Haskell2011" :: Text) ~?> field 0 "other-modules" parseList
|
||||
`leavesUnconsumed` "default-language: Haskell2011"
|
||||
describe "Should Succeed" $
|
||||
it "succesfully parses empty other-modules" $
|
||||
("other-modules: test\ndefault-language: Haskell2011" :: Text) ~?> field 0 "other-modules" parseList
|
||||
`leavesUnconsumed` "default-language: Haskell2011"
|
||||
|
||||
exeSection :: Text
|
||||
exeSection =
|
||||
|
Loading…
Reference in New Issue
Block a user