Skip to content

Commit f971186

Browse files
authored
Merge pull request #22 from jneira/exe-other-mods
Fix exe other-modules containing dots
2 parents 536b425 + 8d54ae4 commit f971186

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/Hie/Cabal/Parser.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ pathMain i p m o a =
121121
<|> (skipBlockLine i >> pathMain i p m o a)
122122
<|> pure
123123
( map (<//> m) p
124-
<> [ p' <//> (o' <> ".hs")
124+
<> [ p' <//> (o'' <> ".hs")
125125
| p' <- p,
126-
o' <- filter (`notElem` a) o
126+
o' <- filter (`notElem` a) o,
127+
let o'' = T.replace "." "/" o'
127128
]
128129
)
129130

test/Spec.hs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ spec = do
9090
$ it "list with leading commas"
9191
$ ("one\n , two\n , three3" :: Text) ~> parseList 1
9292
`shouldParse` ["one", "two", "three3"]
93+
describe "Should Succeed"
94+
$ it "succesfully parses exe component with other-modules containing dots"
95+
$ exeSection2 ~> parseExe 0
96+
`shouldParse` [ Comp Exe "gen-hie" "app/Main.hs"
97+
, Comp Exe "gen-hie" "app/Hie/Executable/Helper.hs"
98+
, Comp Exe "gen-hie" "app/Hie/Executable/Utils.hs"
99+
]
93100

94101
exeSection :: Text
95102
exeSection =
@@ -175,3 +182,13 @@ libSection3 =
175182
\ , text\n\
176183
\ default-language: Haskell2010\n\
177184
\"
185+
186+
exeSection2 :: Text
187+
exeSection2 =
188+
"executable gen-hie\n\
189+
\ other-modules:\n\
190+
\ Hie.Executable.Helper\n\
191+
\ Hie.Executable.Utils\n\
192+
\ hs-source-dirs:\n\
193+
\ app\n\
194+
\ main-is: Main.hs \n"

0 commit comments

Comments
 (0)