@@ -22,7 +22,7 @@ spec :: Spec
2222spec = describe " Package plugin" packageSpec
2323
2424testdata :: FilePath
25- testdata = " test/ testdata/ addPackageTest"
25+ testdata = " test" </> " testdata" </> " addPackageTest"
2626
2727testPlugins :: IdePlugins
2828testPlugins = pluginDescToIdePlugins [packageDescriptor " package" ]
@@ -31,7 +31,7 @@ cabalProject :: [FilePath]
3131cabalProject = [" cabal-lib" , " cabal-exe" ]
3232
3333hpackProject :: [FilePath ]
34- hpackProject = [" hpack-lib" , " hpack-exe" , " hybrid-lib " , " hybrid-exe " ]
34+ hpackProject = [" hpack-lib" , " hpack-exe" ]
3535
3636packageSpec :: Spec
3737packageSpec = do
@@ -239,80 +239,7 @@ packageSpec = do
239239 ]
240240 ]
241241 testCommand testPlugins act " package" " add" args res
242- it
243- " Add package to package.yaml in hpack project with generated cabal to executable component"
244- $ withCurrentDirectory (testdata </> " hybrid-exe" )
245- $ do
246- let
247- fp = cwd </> testdata </> " hybrid-exe"
248- uri = filePathToUri $ fp </> " package.yaml"
249- args = AddParams fp (fp </> " app" </> " Asdf.hs" ) " zlib"
250- act = addCmd' args
251- res = IdeResultOk
252- $ WorkspaceEdit (Just $ H. singleton uri textEdits) Nothing
253- textEdits = List
254- [ TextEdit (Range (Position 0 0 ) (Position 37 0 )) $ T. concat
255- [ " library:\n "
256- , " source-dirs: src\n "
257- , " dependencies:\n "
258- , " - base\n "
259- , " copyright: 2018 Author name here\n "
260- ,
" maintainer: [email protected] \n " 261- , " name: asdf\n "
262- , " version: 0.1.0.0\n "
263- , " extra-source-files:\n "
264- , " - README.md\n "
265- , " - ChangeLog.md\n "
266- , " author: Author name here\n "
267- , " github: githubuser/asdf\n "
268- , " license: BSD3\n "
269- , " executables:\n "
270- , " asdf-exe:\n "
271- , " source-dirs: app\n "
272- , " main: Main.hs\n "
273- , " ghc-options:\n "
274- , " - -threaded\n "
275- , " - -rtsopts\n "
276- , " - -with-rtsopts=-N\n "
277- , " dependencies:\n "
278- , " - zlib\n "
279- , " - base\n "
280- , " - asdf\n "
281- , " description: Please see the README on GitHub at <https://github.com/githubuser/asdf#readme>\n "
282- ]
283- ]
284- testCommand testPlugins act " package" " add" args res
285- it " Add package to package.yaml in hpack project with generated cabal to library component"
286- $ withCurrentDirectory (testdata </> " hybrid-lib" )
287- $ do
288- let
289- fp = cwd </> testdata </> " hybrid-lib"
290- uri = filePathToUri $ fp </> " package.yaml"
291- args = AddParams fp (fp </> " app" </> " Asdf.hs" ) " zlib"
292- act = addCmd' args
293- res = IdeResultOk
294- $ WorkspaceEdit (Just $ H. singleton uri textEdits) Nothing
295- textEdits = List
296- [ TextEdit (Range (Position 0 0 ) (Position 25 0 )) $ T. concat
297- [ " library:\n "
298- , " source-dirs: app\n "
299- , " dependencies:\n "
300- , " - zlib\n "
301- , " - base >= 4.7 && < 5\n "
302- , " copyright: 2018 Author name here\n "
303- ,
" maintainer: [email protected] \n " 304- , " name: asdf\n "
305- , " version: 0.1.0.0\n "
306- , " extra-source-files:\n "
307- , " - README.md\n "
308- , " - ChangeLog.md\n "
309- , " author: Author name here\n "
310- , " github: githubuser/asdf\n "
311- , " license: BSD3\n "
312- , " description: Please see the README on GitHub at <https://github.com/githubuser/asdf#readme>\n "
313- ]
314- ]
315- testCommand testPlugins act " package" " add" args res
242+
316243 it " Do nothing on NoPackage"
317244 $ withCurrentDirectory (testdata </> " invalid" )
318245 $ do
0 commit comments