@@ -156,50 +156,28 @@ transitiveDependencyTest = testSessionWithExtraFiles "dependency" "goto transiti
156
156
++ show wrongLocation
157
157
158
158
-- Testing that we can go to a definition in an autogen module of a
159
- -- dependency. Stylish haskell is a package that has an autogen module,
160
- -- but it doesn't seem to build with ghc 9.0 or earlier. Suggestions on
161
- -- another package we could use for this test are welcome! This test
162
- -- doesn't go directly to the fuction in the autogen module because
163
- -- it is a hidden module, so we can't import that function directly
164
- -- in our project. However, hidden modules are also indexed, so we
165
- -- can go to a definition in a module that imports the autogen module
166
- -- and goto the autogen module from there.
159
+ -- dependency. We use the repository https://github.com/nlander/minimal-autogen.git
160
+ -- as the dependency. It is a minimal package with an autogen module,
161
+ -- allowing us to avoid building a larger dependency in CI just for
162
+ -- this test.
167
163
autogenDependencyTest :: TestTree
168
- autogenDependencyTest = knownBrokenForGhcVersions [GHC810 , GHC90 ] " stylish-haskell does not build with older GHC versions" $
169
- testSessionWithExtraFiles " dependency-autogen" " goto autogen module in dependency" $
164
+ autogenDependencyTest = testSessionWithExtraFiles " dependency-autogen" " goto autogen module in dependency" $
170
165
\ dir -> do
171
166
localDoc <- openDoc (dir </> " Dependency" <.> " hs" ) " haskell"
172
- _hieFile <- fileDoneIndexing [" Paths_stylish_haskell.hie" ]
173
- stylishDefs <- getDefinitions localDoc (Position 5 5 )
174
- stylishFile <- case stylishDefs of
175
- InL (Definition (InR [Location uri _actualRange])) ->
176
- liftIO $ do
177
- let fp :: FilePath
178
- fp = fromMaybe " " $ uriToFilePath uri
179
- locationDirectories :: [String ]
180
- locationDirectories = splitDirectories fp
181
- assertBool " tags found in a module that is not Language.Haskell.Stylish"
182
- $ [" Language" , " Haskell" , " Stylish.hs" ]
183
- `isSuffixOf` locationDirectories
184
- pure fp
185
- wrongLocation ->
186
- liftIO $
187
- assertFailure $ " Wrong location for AsyncCancelled: "
188
- ++ show wrongLocation
189
- stylishDoc <- openDoc stylishFile " haskell"
190
- pathsDefs <- getDefinitions stylishDoc (Position 19 8 )
167
+ _hieFile <- fileDoneIndexing [" Paths_minimal_autogen.hie" ]
168
+ defs <- getDefinitions localDoc (Position 6 5 )
191
169
-- The location of the definition of version in
192
- -- Paths_stylish_haskell
170
+ -- Paths_minimal_autogen
193
171
let expRange = Range (Position 35 0 ) (Position 35 7 )
194
- case pathsDefs of
172
+ case defs of
195
173
InL (Definition (InR [Location uri actualRange])) ->
196
174
liftIO $ do
197
175
let locationDirectories :: [String ]
198
176
locationDirectories =
199
177
maybe [] splitDirectories $
200
178
uriToFilePath uri
201
- assertBool " version found in a module that is not Paths_stylish_haskell "
202
- $ [" Paths_stylish_haskell .hs" ]
179
+ assertBool " version found in a module that is not Paths_minimal_autogen "
180
+ $ [" Paths_minimal_autogen .hs" ]
203
181
`isSuffixOf` locationDirectories
204
182
actualRange @?= expRange
205
183
wrongLocation ->
0 commit comments