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

Remove "hybrid" test cases #1324

Merged
merged 2 commits into from
Jul 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions test/functional/FunctionalCodeActionsSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,32 +268,6 @@ spec = describe "code actions" $ do
T.lines contents !! 3 `shouldSatisfy` T.isSuffixOf "zlib"
T.lines contents !! 21 `shouldNotSatisfy` T.isSuffixOf "zlib"

it "adds to hpack package.yaml files if both are present" $
runSession hieCommand fullCaps "test/testdata/addPackageTest/hybrid-exe" $ do
doc <- openDoc "app/Asdf.hs" "haskell"

-- ignore the first empty hlint diagnostic publish
[_,diag:_] <- count 2 waitForDiagnostics

let preds = [ T.isPrefixOf "Could not load module ‘Codec.Compression.GZip’"
, T.isPrefixOf "Could not find module ‘Codec.Compression.GZip’"
]
in liftIO $ diag ^. L.message `shouldSatisfy` \x -> any (\f -> f x) preds

mActions <- getAllCodeActions doc
let allActions = map fromAction mActions
action = head allActions

liftIO $ do
action ^. L.title `shouldBe` "Add zlib as a dependency"
forM_ allActions $ \a -> a ^. L.kind `shouldBe` Just CodeActionQuickFix
forM_ allActions $ \a -> a ^. L.command . _Just . L.command `shouldSatisfy` T.isSuffixOf "package:add"

executeCodeAction action

contents <- getDocumentEdit . TextDocumentIdentifier =<< getDocUri "package.yaml"
liftIO $
T.lines contents !! 23 `shouldSatisfy` T.isSuffixOf "zlib"

-- -----------------------------------

Expand Down
2 changes: 0 additions & 2 deletions test/testdata/addPackageTest/hybrid-exe/AddPackage.hs

This file was deleted.

5 changes: 0 additions & 5 deletions test/testdata/addPackageTest/hybrid-exe/app/Asdf.hs

This file was deleted.

60 changes: 0 additions & 60 deletions test/testdata/addPackageTest/hybrid-exe/asdf.cabal

This file was deleted.

37 changes: 0 additions & 37 deletions test/testdata/addPackageTest/hybrid-exe/package.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions test/testdata/addPackageTest/hybrid-lib/app/Asdf.hs

This file was deleted.

36 changes: 0 additions & 36 deletions test/testdata/addPackageTest/hybrid-lib/asdf.cabal

This file was deleted.

25 changes: 0 additions & 25 deletions test/testdata/addPackageTest/hybrid-lib/package.yaml

This file was deleted.

79 changes: 3 additions & 76 deletions test/unit/PackagePluginSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec :: Spec
spec = describe "Package plugin" packageSpec

testdata :: FilePath
testdata = "test/testdata/addPackageTest"
testdata = "test" </> "testdata" </> "addPackageTest"

testPlugins :: IdePlugins
testPlugins = pluginDescToIdePlugins [packageDescriptor "package"]
Expand All @@ -31,7 +31,7 @@ cabalProject :: [FilePath]
cabalProject = ["cabal-lib", "cabal-exe"]

hpackProject :: [FilePath]
hpackProject = ["hpack-lib", "hpack-exe", "hybrid-lib", "hybrid-exe"]
hpackProject = ["hpack-lib", "hpack-exe"]

packageSpec :: Spec
packageSpec = do
Expand Down Expand Up @@ -239,80 +239,7 @@ packageSpec = do
]
]
testCommand testPlugins act "package" "add" args res
it
"Add package to package.yaml in hpack project with generated cabal to executable component"
$ withCurrentDirectory (testdata </> "hybrid-exe")
$ do
let
fp = cwd </> testdata </> "hybrid-exe"
uri = filePathToUri $ fp </> "package.yaml"
args = AddParams fp (fp </> "app" </> "Asdf.hs") "zlib"
act = addCmd' args
res = IdeResultOk
$ WorkspaceEdit (Just $ H.singleton uri textEdits) Nothing
textEdits = List
[ TextEdit (Range (Position 0 0) (Position 37 0)) $ T.concat
[ "library:\n"
, " source-dirs: src\n"
, " dependencies:\n"
, " - base\n"
, "copyright: 2018 Author name here\n"
, "maintainer: [email protected]\n"
, "name: asdf\n"
, "version: 0.1.0.0\n"
, "extra-source-files:\n"
, "- README.md\n"
, "- ChangeLog.md\n"
, "author: Author name here\n"
, "github: githubuser/asdf\n"
, "license: BSD3\n"
, "executables:\n"
, " asdf-exe:\n"
, " source-dirs: app\n"
, " main: Main.hs\n"
, " ghc-options:\n"
, " - -threaded\n"
, " - -rtsopts\n"
, " - -with-rtsopts=-N\n"
, " dependencies:\n"
, " - zlib\n"
, " - base\n"
, " - asdf\n"
, "description: Please see the README on GitHub at <https://github.com/githubuser/asdf#readme>\n"
]
]
testCommand testPlugins act "package" "add" args res
it "Add package to package.yaml in hpack project with generated cabal to library component"
$ withCurrentDirectory (testdata </> "hybrid-lib")
$ do
let
fp = cwd </> testdata </> "hybrid-lib"
uri = filePathToUri $ fp </> "package.yaml"
args = AddParams fp (fp </> "app" </> "Asdf.hs") "zlib"
act = addCmd' args
res = IdeResultOk
$ WorkspaceEdit (Just $ H.singleton uri textEdits) Nothing
textEdits = List
[ TextEdit (Range (Position 0 0) (Position 25 0)) $ T.concat
[ "library:\n"
, " source-dirs: app\n"
, " dependencies:\n"
, " - zlib\n"
, " - base >= 4.7 && < 5\n"
, "copyright: 2018 Author name here\n"
, "maintainer: [email protected]\n"
, "name: asdf\n"
, "version: 0.1.0.0\n"
, "extra-source-files:\n"
, "- README.md\n"
, "- ChangeLog.md\n"
, "author: Author name here\n"
, "github: githubuser/asdf\n"
, "license: BSD3\n"
, "description: Please see the README on GitHub at <https://github.com/githubuser/asdf#readme>\n"
]
]
testCommand testPlugins act "package" "add" args res

it "Do nothing on NoPackage"
$ withCurrentDirectory (testdata </> "invalid")
$ do
Expand Down
2 changes: 0 additions & 2 deletions test/utils/TestUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,8 @@ files =
[ "./test/testdata/"
, "./test/testdata/addPackageTest/cabal-exe/"
, "./test/testdata/addPackageTest/hpack-exe/"
, "./test/testdata/addPackageTest/hybrid-exe/"
, "./test/testdata/addPackageTest/cabal-lib/"
, "./test/testdata/addPackageTest/hpack-lib/"
, "./test/testdata/addPackageTest/hybrid-lib/"
, "./test/testdata/addPragmas/"
, "./test/testdata/badProjects/cabal/"
, "./test/testdata/completion/"
Expand Down