Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 0897e55

Browse files
authored
Merge pull request #1324 from fendor/remove-cabal-test-file
Remove "hybrid" test cases
2 parents 46cc80b + d18813b commit 0897e55

File tree

10 files changed

+3
-274
lines changed

10 files changed

+3
-274
lines changed

test/functional/FunctionalCodeActionsSpec.hs

-26
Original file line numberDiff line numberDiff line change
@@ -268,32 +268,6 @@ spec = describe "code actions" $ do
268268
T.lines contents !! 3 `shouldSatisfy` T.isSuffixOf "zlib"
269269
T.lines contents !! 21 `shouldNotSatisfy` T.isSuffixOf "zlib"
270270

271-
it "adds to hpack package.yaml files if both are present" $
272-
runSession hieCommand fullCaps "test/testdata/addPackageTest/hybrid-exe" $ do
273-
doc <- openDoc "app/Asdf.hs" "haskell"
274-
275-
-- ignore the first empty hlint diagnostic publish
276-
[_,diag:_] <- count 2 waitForDiagnostics
277-
278-
let preds = [ T.isPrefixOf "Could not load module ‘Codec.Compression.GZip’"
279-
, T.isPrefixOf "Could not find module ‘Codec.Compression.GZip’"
280-
]
281-
in liftIO $ diag ^. L.message `shouldSatisfy` \x -> any (\f -> f x) preds
282-
283-
mActions <- getAllCodeActions doc
284-
let allActions = map fromAction mActions
285-
action = head allActions
286-
287-
liftIO $ do
288-
action ^. L.title `shouldBe` "Add zlib as a dependency"
289-
forM_ allActions $ \a -> a ^. L.kind `shouldBe` Just CodeActionQuickFix
290-
forM_ allActions $ \a -> a ^. L.command . _Just . L.command `shouldSatisfy` T.isSuffixOf "package:add"
291-
292-
executeCodeAction action
293-
294-
contents <- getDocumentEdit . TextDocumentIdentifier =<< getDocUri "package.yaml"
295-
liftIO $
296-
T.lines contents !! 23 `shouldSatisfy` T.isSuffixOf "zlib"
297271

298272
-- -----------------------------------
299273

test/testdata/addPackageTest/hybrid-exe/AddPackage.hs

-2
This file was deleted.

test/testdata/addPackageTest/hybrid-exe/app/Asdf.hs

-5
This file was deleted.

test/testdata/addPackageTest/hybrid-exe/asdf.cabal

-60
This file was deleted.

test/testdata/addPackageTest/hybrid-exe/package.yaml

-37
This file was deleted.

test/testdata/addPackageTest/hybrid-lib/app/Asdf.hs

-5
This file was deleted.

test/testdata/addPackageTest/hybrid-lib/asdf.cabal

-36
This file was deleted.

test/testdata/addPackageTest/hybrid-lib/package.yaml

-25
This file was deleted.

test/unit/PackagePluginSpec.hs

+3-76
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec :: Spec
2222
spec = describe "Package plugin" packageSpec
2323

2424
testdata :: FilePath
25-
testdata = "test/testdata/addPackageTest"
25+
testdata = "test" </> "testdata" </> "addPackageTest"
2626

2727
testPlugins :: IdePlugins
2828
testPlugins = pluginDescToIdePlugins [packageDescriptor "package"]
@@ -31,7 +31,7 @@ cabalProject :: [FilePath]
3131
cabalProject = ["cabal-lib", "cabal-exe"]
3232

3333
hpackProject :: [FilePath]
34-
hpackProject = ["hpack-lib", "hpack-exe", "hybrid-lib", "hybrid-exe"]
34+
hpackProject = ["hpack-lib", "hpack-exe"]
3535

3636
packageSpec :: Spec
3737
packageSpec = 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

test/utils/TestUtils.hs

-2
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,8 @@ files =
107107
[ "./test/testdata/"
108108
, "./test/testdata/addPackageTest/cabal-exe/"
109109
, "./test/testdata/addPackageTest/hpack-exe/"
110-
, "./test/testdata/addPackageTest/hybrid-exe/"
111110
, "./test/testdata/addPackageTest/cabal-lib/"
112111
, "./test/testdata/addPackageTest/hpack-lib/"
113-
, "./test/testdata/addPackageTest/hybrid-lib/"
114112
, "./test/testdata/addPragmas/"
115113
, "./test/testdata/badProjects/cabal/"
116114
, "./test/testdata/completion/"

0 commit comments

Comments
 (0)