Merge pull request #22 from jneira/exe-other-mods

Fix exe other-modules containing dots
This commit is contained in:
Javier Neira 2020-10-15 11:52:12 +02:00 committed by GitHub
commit f971186c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -121,9 +121,10 @@ pathMain i p m o a =
<|> (skipBlockLine i >> pathMain i p m o a)
<|> pure
( map (<//> m) p
<> [ p' <//> (o' <> ".hs")
<> [ p' <//> (o'' <> ".hs")
| p' <- p,
o' <- filter (`notElem` a) o
o' <- filter (`notElem` a) o,
let o'' = T.replace "." "/" o'
]
)

View File

@ -90,6 +90,13 @@ spec = do
$ it "list with leading commas"
$ ("one\n , two\n , three3" :: Text) ~> parseList 1
`shouldParse` ["one", "two", "three3"]
describe "Should Succeed"
$ it "succesfully parses exe component with other-modules containing dots"
$ exeSection2 ~> parseExe 0
`shouldParse` [ Comp Exe "gen-hie" "app/Main.hs"
, Comp Exe "gen-hie" "app/Hie/Executable/Helper.hs"
, Comp Exe "gen-hie" "app/Hie/Executable/Utils.hs"
]
exeSection :: Text
exeSection =
@ -175,3 +182,13 @@ libSection3 =
\ , text\n\
\ default-language: Haskell2010\n\
\"
exeSection2 :: Text
exeSection2 =
"executable gen-hie\n\
\ other-modules:\n\
\ Hie.Executable.Helper\n\
\ Hie.Executable.Utils\n\
\ hs-source-dirs:\n\
\ app\n\
\ main-is: Main.hs \n"