diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed8b0fcc4a..44d0d90e3e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -148,3 +148,10 @@ jobs: HLS_TEST_EXE: hls HLS_WRAPPER_TEST_EXE: hls-wrapper run: cabal test hls-stylish-haskell-plugin || cabal test hls-stylish-haskell-plugin --test-options="-j1" + + - name: Test eval plugin + if: ${{ matrix.test }} + env: + HLS_TEST_EXE: hls + HLS_WRAPPER_TEST_EXE: hls-wrapper + run: cabal test hls-eval-plugin || cabal test hls-eval-plugin --test-options="-j1" diff --git a/cabal.project b/cabal.project index 0c18e8dd70..745f326e6e 100644 --- a/cabal.project +++ b/cabal.project @@ -4,6 +4,7 @@ packages: ./shake-bench ./ghcide ./hls-plugin-api + ./hls-test-utils ./plugins/hls-tactics-plugin ./plugins/hls-brittany-plugin ./plugins/hls-stylish-haskell-plugin diff --git a/exe/Main.hs b/exe/Main.hs index 405f8bd662..21b9cdc774 100644 --- a/exe/Main.hs +++ b/exe/Main.hs @@ -6,11 +6,10 @@ module Main(main) where import Ide.Arguments (Arguments (..), LspArguments (..), getArguments) import Ide.Main (defaultMain) -import Main.Utf8 (withUtf8) import Plugins main :: IO () -main = withUtf8 $ do +main = do args <- getArguments "haskell-language-server" let withExamples = diff --git a/ghcide/src/Development/IDE/Main.hs b/ghcide/src/Development/IDE/Main.hs index 2d8128e69a..4695233bc8 100644 --- a/ghcide/src/Development/IDE/Main.hs +++ b/ghcide/src/Development/IDE/Main.hs @@ -53,6 +53,7 @@ import Development.IDE.Types.Options (IdeGhcSession, defaultIdeOptions) import Development.IDE.Types.Shake (Key (Key)) import Development.Shake (action) +import GHC.IO.Encoding (setLocaleEncoding) import HIE.Bios.Cradle (findCradle) import Ide.Plugin.Config (CheckParents (NeverCheck), Config, @@ -116,6 +117,7 @@ stderrLogger = do defaultMain :: Arguments -> IO () defaultMain Arguments{..} = do + setLocaleEncoding utf8 pid <- T.pack . show <$> getProcessID logger <- argsLogger hSetBuffering stderr LineBuffering diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 034be3ea7a..daf705de91 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -327,7 +327,6 @@ executable haskell-language-server , temporary , transformers , unordered-containers - , with-utf8 include-dirs: include default-language: Haskell2010 @@ -363,43 +362,9 @@ executable haskell-language-server-wrapper default-language: Haskell2010 --- This common stanza simulates a previous private lib --- We removed it due to issues with stack when loading the project using a stack based hie.yaml --- See https://github.com/haskell/haskell-language-server/issues/114 -common hls-test-utils - import: common-deps - hs-source-dirs: test/utils - other-modules: Test.Hls.Util - build-depends: - , aeson - , blaze-markup - , containers - , data-default - , lsp - , hie-bios - , hls-plugin-api >= 1.0 && < 1.2 - , hslogger - , hspec - , hspec-core - , lens - , lsp-test == 0.13.0.0 - , stm - , tasty-expected-failure - , tasty-hunit - , temporary - , transformers - , unordered-containers - , yaml - - ghc-options: -Wall -Wredundant-constraints - - if flag(pedantic) - ghc-options: -Werror - - default-language: Haskell2010 test-suite func-test - import: common-deps, hls-test-utils + import: common-deps type: exitcode-stdio-1.0 default-language: Haskell2010 build-tool-depends: @@ -411,15 +376,16 @@ test-suite func-test , data-default , hspec-expectations , lens - , tasty - , tasty-ant-xml >=1.1.6 - , tasty-golden - , tasty-rerun - , megaparsec - , deepseq , ghcide + , hls-test-utils + , lsp-types + , aeson + , hls-plugin-api >= 1.0 && < 1.2 + , lsp-test == 0.13.0.0 + , containers + , unordered-containers - hs-source-dirs: test/functional plugins/hls-eval-plugin/test plugins/hls-splice-plugin/src plugins/hls-eval-plugin/src + hs-source-dirs: test/functional plugins/hls-splice-plugin/src main-is: Main.hs other-modules: @@ -430,7 +396,6 @@ test-suite func-test Deferred Definition Diagnostic - Eval Format FunctionalBadProject FunctionalCodeAction @@ -446,7 +411,6 @@ test-suite func-test Splice HaddockComments Ide.Plugin.Splice.Types - Ide.Plugin.Eval.Types default-extensions: OverloadedStrings ghc-options: @@ -456,7 +420,6 @@ test-suite func-test ghc-options: -Werror -Wredundant-constraints test-suite wrapper-test - import: hls-test-utils type: exitcode-stdio-1.0 build-tool-depends: haskell-language-server:haskell-language-server-wrapper -any @@ -466,9 +429,8 @@ test-suite wrapper-test , base , directory , process - , tasty - , tasty-ant-xml >=1.1.6 - , tasty-rerun + , hls-test-utils + , extra hs-source-dirs: test/wrapper main-is: Main.hs diff --git a/hls-test-utils/LICENSE b/hls-test-utils/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/hls-test-utils/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/hls-test-utils/hls-test-utils.cabal b/hls-test-utils/hls-test-utils.cabal new file mode 100644 index 0000000000..bf99a88ee7 --- /dev/null +++ b/hls-test-utils/hls-test-utils.cabal @@ -0,0 +1,65 @@ +cabal-version: 2.2 +name: hls-test-utils +version: 1.0.0.0 +synopsis: Utilities used in the tests of Haskell Language Server +description: + Please see the README on GitHub at + +homepage: + https://github.com/haskell/haskell-language-server/hls-test-utils + +bug-reports: https://github.com/haskell/haskell-language-server/issues +license: Apache-2.0 +license-file: LICENSE +author: The Haskell IDE Team +maintainer: alan.zimm@gmail.com +copyright: The Haskell IDE Team +category: Development +build-type: Simple + +flag pedantic + description: Enable -Werror + default: False + manual: True + +source-repository head + type: git + location: https://github.com/haskell/haskell-language-server + +library + exposed-modules: + Test.Hls + Test.Hls.Util + + hs-source-dirs: src + build-depends: + , aeson + , base + , blaze-markup + , bytestring + , containers + , data-default + , directory + , extra + , filepath + , hspec + , hspec-core + , lens + , lsp-test ==0.13.0.0 + , lsp-types ^>=1.1 + , tasty + , tasty-ant-xml >=1.1.6 + , tasty-expected-failure + , tasty-golden + , tasty-hunit + , tasty-rerun + , temporary + , text + , unordered-containers + + ghc-options: -Wall + + if flag(pedantic) + ghc-options: -Werror + + default-language: Haskell2010 diff --git a/hls-test-utils/src/Test/Hls.hs b/hls-test-utils/src/Test/Hls.hs new file mode 100644 index 0000000000..10cb8eefb1 --- /dev/null +++ b/hls-test-utils/src/Test/Hls.hs @@ -0,0 +1,46 @@ +module Test.Hls + ( module Test.Tasty.HUnit, + module Test.Tasty, + module Test.Tasty.ExpectedFailure, + module Test.Hls.Util, + module Language.LSP.Types, + module Language.LSP.Test, + module Control.Monad.IO.Class, + module Control.Applicative.Combinators, + defaultTestRunner, + goldenGitDiff, + testCommand, + def, + ) +where + +import Control.Applicative.Combinators +import Control.Monad.IO.Class +import Data.ByteString.Lazy (ByteString) +import Data.Default (def) +import Language.LSP.Test +import Language.LSP.Types +import Test.Hls.Util +import Test.Tasty hiding (Timeout) +import Test.Tasty.ExpectedFailure +import Test.Tasty.Golden +import Test.Tasty.HUnit +import Test.Tasty.Ingredients.Rerun +import Test.Tasty.Runners +import Test.Tasty.Runners.AntXML + +-- | ingredient: xml runner writes json file of test results (https://github.com/ocharles/tasty-ant-xml/blob/master/Test/Tasty/Runners/AntXML.hs) +-- rerunningTests allow rerun of failed tests (https://github.com/ocharles/tasty-rerun/blob/master/src/Test/Tasty/Ingredients/Rerun.hs) +defaultTestRunner :: TestTree -> IO () +defaultTestRunner = + defaultMainWithIngredients + [antXMLRunner, rerunningTests [listingTests, consoleTestReporter]] + +gitDiff :: FilePath -> FilePath -> [String] +gitDiff fRef fNew = ["git", "diff", "--no-index", "--text", "--exit-code", fRef, fNew] + +goldenGitDiff :: TestName -> FilePath -> IO ByteString -> TestTree +goldenGitDiff name = goldenVsStringDiff name gitDiff + +testCommand :: String +testCommand = "test-server" diff --git a/test/utils/Test/Hls/Util.hs b/hls-test-utils/src/Test/Hls/Util.hs similarity index 100% rename from test/utils/Test/Hls/Util.hs rename to hls-test-utils/src/Test/Hls/Util.hs diff --git a/nix/default.nix b/nix/default.nix index 2c5c64dc87..5ce0b4d10a 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -28,6 +28,7 @@ let shake-bench = gitignoreSource ../shake-bench; hie-compat = gitignoreSource ../hie-compat; hls-plugin-api = gitignoreSource ../hls-plugin-api; + hls-test-utils = gitignoreSource ../hls-test-utils; hls-brittany-plugin = gitignoreSource ../plugins/hls-brittany-plugin; hls-stylish-haskell-plugin = gitignoreSource ../plugins/hls-stylish-haskell-plugin; hls-class-plugin = gitignoreSource ../plugins/hls-class-plugin; diff --git a/plugins/hls-brittany-plugin/hls-brittany-plugin.cabal b/plugins/hls-brittany-plugin/hls-brittany-plugin.cabal index 0c3961e852..4b4940bf64 100644 --- a/plugins/hls-brittany-plugin/hls-brittany-plugin.cabal +++ b/plugins/hls-brittany-plugin/hls-brittany-plugin.cabal @@ -50,20 +50,8 @@ test-suite tests hs-source-dirs: test main-is: Main.hs build-depends: - , aeson , base , bytestring - , data-default - , deepseq - , ghcide ^>= 1.1.0.0 , hls-brittany-plugin - , hspec-expectations - , megaparsec - , lens - , lsp-test - , tasty - , tasty-ant-xml >=1.1.6 - , tasty-hunit - , tasty-golden - , tasty-rerun , text + , hls-test-utils diff --git a/plugins/hls-brittany-plugin/test/Main.hs b/plugins/hls-brittany-plugin/test/Main.hs index 1065db972d..0d981947b5 100644 --- a/plugins/hls-brittany-plugin/test/Main.hs +++ b/plugins/hls-brittany-plugin/test/Main.hs @@ -1,54 +1,35 @@ {-# LANGUAGE OverloadedStrings #-} module Main(main) where -import Control.Monad.IO.Class -import Data.Aeson import qualified Data.ByteString.Lazy as BS import qualified Data.Text.Encoding as T import qualified Data.Text.IO as T -import Language.LSP.Test -import Language.LSP.Types -import Test.Tasty -import Test.Tasty.Golden -import Test.Tasty.HUnit -import Test.Tasty.Runners ( - consoleTestReporter, - listingTests, - ) -import Test.Tasty.Ingredients.Rerun -import Test.Tasty.Runners.AntXML +import Test.Hls main :: IO () -main = defaultMainWithIngredients - [antXMLRunner, rerunningTests [listingTests, consoleTestReporter]] - tests - -testCommand = "test-server" +main = defaultTestRunner tests tests :: TestTree tests = testGroup "brittany" [ - goldenVsStringDiff "formats a document with LF endings" goldenGitDiff "test/testdata/BrittanyLF.formatted_document.hs" $ runSession testCommand fullCaps "test/testdata" $ do + goldenGitDiff "formats a document with LF endings" "test/testdata/BrittanyLF.formatted_document.hs" $ runSession testCommand fullCaps "test/testdata" $ do doc <- openDoc "BrittanyLF.hs" "haskell" formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a document with CRLF endings" goldenGitDiff "test/testdata/BrittanyCRLF.formatted_document.hs" $ runSession testCommand fullCaps "test/testdata" $ do + , goldenGitDiff "formats a document with CRLF endings" "test/testdata/BrittanyCRLF.formatted_document.hs" $ runSession testCommand fullCaps "test/testdata" $ do doc <- openDoc "BrittanyCRLF.hs" "haskell" formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a range with LF endings" goldenGitDiff "test/testdata/BrittanyLF.formatted_range.hs" $ runSession testCommand fullCaps "test/testdata" $ do + , goldenGitDiff "formats a range with LF endings" "test/testdata/BrittanyLF.formatted_range.hs" $ runSession testCommand fullCaps "test/testdata" $ do doc <- openDoc "BrittanyLF.hs" "haskell" let range = Range (Position 1 0) (Position 2 22) formatRange doc (FormattingOptions 4 True Nothing Nothing Nothing) range BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a range with CRLF endings" goldenGitDiff "test/testdata/BrittanyCRLF.formatted_range.hs" $ runSession testCommand fullCaps "test/testdata" $ do + , goldenGitDiff "formats a range with CRLF endings" "test/testdata/BrittanyCRLF.formatted_range.hs" $ runSession testCommand fullCaps "test/testdata" $ do doc <- openDoc "BrittanyCRLF.hs" "haskell" let range = Range (Position 1 0) (Position 2 22) formatRange doc (FormattingOptions 4 True Nothing Nothing Nothing) range BS.fromStrict . T.encodeUtf8 <$> documentContents doc ] - -goldenGitDiff :: FilePath -> FilePath -> [String] -goldenGitDiff fRef fNew = ["git", "diff", "--no-index", "--text", "--exit-code", fRef, fNew] diff --git a/plugins/hls-eval-plugin/hls-eval-plugin.cabal b/plugins/hls-eval-plugin/hls-eval-plugin.cabal index fa5e6e2992..30a8512d24 100644 --- a/plugins/hls-eval-plugin/hls-eval-plugin.cabal +++ b/plugins/hls-eval-plugin/hls-eval-plugin.cabal @@ -1,19 +1,29 @@ -cabal-version: 2.2 +cabal-version: 2.4 name: hls-eval-plugin version: 1.0.0.0 synopsis: Eval plugin for Haskell Language Server -description: Please see the README on GitHub at +description: + Please see the README on GitHub at + category: Development bug-reports: https://github.com/haskell/haskell-language-server/issues license: Apache-2.0 license-file: LICENSE -author: https://github.com/haskell/haskell-language-server/contributors -maintainer: https://github.com/haskell/haskell-language-server/contributors +author: + https://github.com/haskell/haskell-language-server/contributors + +maintainer: + https://github.com/haskell/haskell-language-server/contributors build-type: Simple extra-source-files: LICENSE README.md + test/testdata/*.yaml + test/testdata/*.hs + test/testdata/*.expected + test/testdata/*.lhs + test/testdata/*.cabal flag pedantic description: Enable -Werror @@ -25,15 +35,17 @@ source-repository head location: https://github.com/haskell/haskell-language-server library - exposed-modules: Ide.Plugin.Eval - hs-source-dirs: src + exposed-modules: + Ide.Plugin.Eval + Ide.Plugin.Eval.Types + + hs-source-dirs: src other-modules: Ide.Plugin.Eval.Code Ide.Plugin.Eval.CodeLens Ide.Plugin.Eval.GHC Ide.Plugin.Eval.Parse.Comments Ide.Plugin.Eval.Parse.Option - Ide.Plugin.Eval.Types Ide.Plugin.Eval.Util build-depends: @@ -49,12 +61,12 @@ library , ghc , ghc-boot-th , ghc-paths - , ghcide ^>= 1.1.0.0 + , ghcide ^>=1.1.0.0 , hashable + , hls-plugin-api >=1.0 && <1.2 + , lens , lsp , lsp-types - , hls-plugin-api >= 1.0 && < 1.2 - , lens , megaparsec >=9.0 , mtl , parser-combinators @@ -66,13 +78,50 @@ library , text , time , transformers - , unordered-containers , unliftio + , unordered-containers - ghc-options: -Wall -Wno-name-shadowing -Wno-unticked-promoted-constructors + ghc-options: + -Wall -Wno-name-shadowing -Wno-unticked-promoted-constructors if flag(pedantic) ghc-options: -Werror + default-language: Haskell2010 + default-extensions: + DataKinds + TypeOperators + +executable test-server default-language: Haskell2010 - default-extensions: DataKinds, TypeOperators + build-depends: + , base + , data-default + , ghcide + , hls-eval-plugin + , hls-plugin-api + + main-is: Server.hs + hs-source-dirs: test + ghc-options: -threaded + +test-suite tests + type: exitcode-stdio-1.0 + default-language: Haskell2010 + build-tool-depends: hls-eval-plugin:test-server -any + hs-source-dirs: test + main-is: Main.hs + ghc-options: -Wunused-packages + + build-depends: + , aeson + , base + , directory + , extra + , filepath + , hls-eval-plugin + , hls-test-utils + , lens + , lsp-test + , lsp-types + , text diff --git a/plugins/hls-eval-plugin/test/Eval.hs b/plugins/hls-eval-plugin/test/Main.hs similarity index 82% rename from plugins/hls-eval-plugin/test/Eval.hs rename to plugins/hls-eval-plugin/test/Main.hs index bd48214c0d..8a09126edd 100644 --- a/plugins/hls-eval-plugin/test/Eval.hs +++ b/plugins/hls-eval-plugin/test/Main.hs @@ -4,60 +4,52 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ViewPatterns #-} -module Eval ( - tests, +module Main ( + main, ) where -import Control.Applicative.Combinators (skipManyTill) -import Control.Lens (_Just, preview, view) -import Control.Monad (when) -import Control.Monad.IO.Class (MonadIO (liftIO)) -import Data.Aeson (fromJSON) -import Data.Aeson.Types (Result (Success)) -import Data.List.Extra (nubOrdOn) -import qualified Data.Text as T -import qualified Data.Text.IO as T -import Ide.Plugin.Eval.Types (EvalParams (..)) -import Language.LSP.Test -import Language.LSP.Types -import Language.LSP.Types.Lens (command, range, title) -import System.Directory (doesFileExist) -import System.FilePath ((<.>), ()) -import Test.Hls.Util (EnvSpec (GhcVer, HostOS), - GhcVersion (GHC84, GHC86), - OS (Windows), hlsCommand, - knownBrokenForGhcVersions, - knownBrokenInEnv) -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.ExpectedFailure (expectFailBecause) -import Test.Tasty.HUnit (testCase, (@?=)) +import Control.Lens (_Just, preview, view) +import Control.Monad (when) +import Data.Aeson (fromJSON) +import Data.Aeson.Types (Result (Success)) +import Data.List.Extra (nubOrdOn) +import qualified Data.Text as T +import qualified Data.Text.IO as T +import Ide.Plugin.Eval.Types (EvalParams (..)) +import Language.LSP.Types.Lens (command, range, title) +import System.Directory (doesFileExist) +import System.FilePath ((<.>), ()) +import Test.Hls + +main :: IO () +main = defaultTestRunner tests tests :: TestTree tests = testGroup "eval" [ testCase "Produces Evaluate code lenses" $ - runSession hlsCommand fullCaps evalPath $ do + runSession testCommand fullCaps evalPath $ do doc <- openDoc "T1.hs" "haskell" lenses <- getEvalCodeLenses doc liftIO $ map (preview $ command . _Just . title) lenses @?= [Just "Evaluate..."] , testCase "Produces Refresh code lenses" $ - runSession hlsCommand fullCaps evalPath $ do + runSession testCommand fullCaps evalPath $ do doc <- openDoc "T2.hs" "haskell" lenses <- getEvalCodeLenses doc liftIO $ map (preview $ command . _Just . title) lenses @?= [Just "Refresh..."] , testCase "Code lenses have ranges" $ - runSession hlsCommand fullCaps evalPath $ do + runSession testCommand fullCaps evalPath $ do doc <- openDoc "T1.hs" "haskell" lenses <- getEvalCodeLenses doc liftIO $ map (view range) lenses @?= [Range (Position 4 0) (Position 5 0)] , testCase "Multi-line expressions have a multi-line range" $ do - runSession hlsCommand fullCaps evalPath $ do + runSession testCommand fullCaps evalPath $ do doc <- openDoc "T3.hs" "haskell" lenses <- getEvalCodeLenses doc liftIO $ map (view range) lenses @?= [Range (Position 3 0) (Position 5 0)] , testCase "Executed expressions range covers only the expression" $ do - runSession hlsCommand fullCaps evalPath $ do + runSession testCommand fullCaps evalPath $ do doc <- openDoc "T2.hs" "haskell" lenses <- getEvalCodeLenses doc liftIO $ map (view range) lenses @?= [Range (Position 4 0) (Position 5 0)] @@ -140,7 +132,7 @@ tests = "Can handle eval inside nested comment properly" $ goldenTest "TNested.hs" , testCase "Test on last line insert results correctly" $ do - runSession hlsCommand fullCaps evalPath $ + runSession testCommand fullCaps evalPath $ liftIO $ do let mdl = "TLastLine.hs" -- Write the test file, to make sure that it has no final line return @@ -168,7 +160,7 @@ goldenTest = goldenTestBy isEvalTest Compare results with the contents of corresponding '.expected' file (and creates it, if missing) -} goldenTestBy :: (CodeLens -> Bool) -> FilePath -> IO () -goldenTestBy fltr input = runSession hlsCommand fullCaps evalPath $ do +goldenTestBy fltr input = runSession testCommand fullCaps evalPath $ do doc <- openDoc input "haskell" -- Execute lenses backwards, to avoid affecting their position in the source file @@ -221,4 +213,4 @@ replaceUnicodeQuotes :: T.Text -> T.Text replaceUnicodeQuotes = T.replace "‘" "'" . T.replace "’" "'" evalPath :: FilePath -evalPath = "plugins/hls-eval-plugin/test/testdata" +evalPath = "test/testdata" diff --git a/plugins/hls-eval-plugin/test/Server.hs b/plugins/hls-eval-plugin/test/Server.hs new file mode 100644 index 0000000000..a30263fc46 --- /dev/null +++ b/plugins/hls-eval-plugin/test/Server.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedStrings #-} +module Main(main) where + +import Data.Default +import Development.IDE.Main +import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide +import Ide.Plugin.Config +import qualified Ide.Plugin.Eval as Eval +import Ide.PluginUtils + +main :: IO () +main = defaultMain def + { argsHlsPlugins = pluginDescToIdePlugins $ + [ Eval.descriptor "eval" + ] <> + Ghcide.descriptors + } diff --git a/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal b/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal index 201f610a6b..ceeffc17bc 100644 --- a/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal +++ b/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal @@ -1,63 +1,58 @@ -cabal-version: 2.2 -name: hls-stylish-haskell-plugin -version: 1.0.0.0 -synopsis: Integration with the Stylish Haskell code formatter -license: Apache-2.0 -license-file: LICENSE -author: The Haskell IDE Team -copyright: The Haskell IDE Team -maintainer: alan.zimm@gmail.com -category: Development -build-type: Simple +cabal-version: 2.4 +name: hls-stylish-haskell-plugin +version: 1.0.0.0 +synopsis: Integration with the Stylish Haskell code formatter +license: Apache-2.0 +license-file: LICENSE +author: The Haskell IDE Team +copyright: The Haskell IDE Team +maintainer: alan.zimm@gmail.com +category: Development +build-type: Simple extra-source-files: LICENSE + test/testdata/*.hs library exposed-modules: Ide.Plugin.StylishHaskell hs-source-dirs: src - build-depends: base - , stylish-haskell ^>=0.12 - , filepath - , ghc - , ghc-boot-th - , directory - , ghcide ^>= 1.1.0.0 - , lsp-types - , hls-plugin-api >= 1.0 && < 1.2 - , text - , mtl + build-depends: + , base + , directory + , filepath + , ghc + , ghc-boot-th + , ghcide ^>=1.1.0.0 + , hls-plugin-api >=1.0 && <1.2 + , lsp-types + , mtl + , stylish-haskell ^>=0.12 + , text default-language: Haskell2010 executable test-server - default-language: Haskell2010 + default-language: Haskell2010 build-depends: , base , data-default , ghcide - , hls-stylish-haskell-plugin , hls-plugin-api - main-is: Server.hs - hs-source-dirs: test - ghc-options: -threaded + , hls-stylish-haskell-plugin + + main-is: Server.hs + hs-source-dirs: test + ghc-options: -threaded test-suite tests type: exitcode-stdio-1.0 default-language: Haskell2010 - build-tool-depends: - hls-stylish-haskell-plugin:test-server -any, - hs-source-dirs: test - main-is: Main.hs + build-tool-depends: hls-stylish-haskell-plugin:test-server -any + hs-source-dirs: test + main-is: Main.hs build-depends: - , aeson , base , bytestring - , ghcide ^>= 1.1.0.0 , hls-stylish-haskell-plugin - , lsp-test - , tasty - , tasty-ant-xml >=1.1.6 - , tasty-hunit - , tasty-golden - , tasty-rerun + , hls-test-utils , text diff --git a/plugins/hls-stylish-haskell-plugin/test/Main.hs b/plugins/hls-stylish-haskell-plugin/test/Main.hs index e1b38d0928..6f0431274f 100644 --- a/plugins/hls-stylish-haskell-plugin/test/Main.hs +++ b/plugins/hls-stylish-haskell-plugin/test/Main.hs @@ -1,39 +1,22 @@ {-# LANGUAGE OverloadedStrings #-} module Main(main) where -import Control.Monad.IO.Class -import Data.Aeson import qualified Data.ByteString.Lazy as BS import qualified Data.Text.Encoding as T import qualified Data.Text.IO as T -import Language.LSP.Test -import Language.LSP.Types -import Test.Tasty -import Test.Tasty.Golden -import Test.Tasty.HUnit -import Test.Tasty.Ingredients.Rerun -import Test.Tasty.Runners (consoleTestReporter, - listingTests) -import Test.Tasty.Runners.AntXML +import Test.Hls main :: IO () -main = defaultMainWithIngredients - [antXMLRunner, rerunningTests [listingTests, consoleTestReporter]] - tests - -testCommand = "test-server" +main = defaultTestRunner tests tests :: TestTree tests = testGroup "stylish-haskell" [ - goldenVsStringDiff "formats a document" goldenGitDiff "test/testdata/StylishHaskell.formatted_document.hs" $ runSession testCommand fullCaps "test/testdata" $ do + goldenGitDiff "formats a document" "test/testdata/StylishHaskell.formatted_document.hs" $ runSession testCommand fullCaps "test/testdata" $ do doc <- openDoc "StylishHaskell.hs" "haskell" formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a range" goldenGitDiff "test/testdata/StylishHaskell.formatted_range.hs" $ runSession testCommand fullCaps "test/testdata" $ do + , goldenGitDiff "formats a range" "test/testdata/StylishHaskell.formatted_range.hs" $ runSession testCommand fullCaps "test/testdata" $ do doc <- openDoc "StylishHaskell.hs" "haskell" formatRange doc (FormattingOptions 2 True Nothing Nothing Nothing) (Range (Position 0 0) (Position 2 21)) BS.fromStrict . T.encodeUtf8 <$> documentContents doc ] - -goldenGitDiff :: FilePath -> FilePath -> [String] -goldenGitDiff fRef fNew = ["git", "diff", "--no-index", "--text", "--exit-code", fRef, fNew] diff --git a/stack-8.10.2.yaml b/stack-8.10.2.yaml index 6ea4bcd07d..d6839f1327 100644 --- a/stack-8.10.2.yaml +++ b/stack-8.10.2.yaml @@ -5,6 +5,7 @@ packages: - ./hie-compat - ./ghcide/ - ./hls-plugin-api + - ./hls-test-utils # - ./shake-bench - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin @@ -53,8 +54,6 @@ extra-deps: - constraints-extras-0.3.0.2@sha256:013b8d0392582c6ca068e226718a4fe8be8e22321cc0634f6115505bf377ad26,1853 - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/stack-8.10.3.yaml b/stack-8.10.3.yaml index 87475dad5e..066ec10edc 100644 --- a/stack-8.10.3.yaml +++ b/stack-8.10.3.yaml @@ -5,6 +5,7 @@ packages: - ./hie-compat - ./ghcide/ - ./hls-plugin-api + - ./hls-test-utils # - ./shake-bench - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin @@ -51,8 +52,6 @@ extra-deps: - constraints-extras-0.3.0.2@sha256:013b8d0392582c6ca068e226718a4fe8be8e22321cc0634f6115505bf377ad26,1853 - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/stack-8.10.4.yaml b/stack-8.10.4.yaml index d2834baa36..d489454027 100644 --- a/stack-8.10.4.yaml +++ b/stack-8.10.4.yaml @@ -5,6 +5,7 @@ packages: - ./hie-compat - ./ghcide/ - ./hls-plugin-api + - ./hls-test-utils # - ./shake-bench - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin @@ -49,8 +50,6 @@ extra-deps: - constraints-extras-0.3.0.2@sha256:013b8d0392582c6ca068e226718a4fe8be8e22321cc0634f6115505bf377ad26,1853 - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/stack-8.6.4.yaml b/stack-8.6.4.yaml index f29d117d27..834f650d24 100644 --- a/stack-8.6.4.yaml +++ b/stack-8.6.4.yaml @@ -7,6 +7,7 @@ packages: - ./ghcide/ # - ./shake-bench - ./hls-plugin-api + - ./hls-test-utils - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin - ./plugins/hls-eval-plugin @@ -91,8 +92,6 @@ extra-deps: - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - resourcet-1.2.3 - # To avoid issue #1372 - - with-utf8-1.0.2.2 flags: haskell-language-server: diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml index 3f70015339..7e339016d0 100644 --- a/stack-8.6.5.yaml +++ b/stack-8.6.5.yaml @@ -5,6 +5,7 @@ packages: - ./hie-compat - ./ghcide/ - ./hls-plugin-api + - ./hls-test-utils # - ./shake-bench - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin @@ -90,8 +91,6 @@ extra-deps: - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - resourcet-1.2.3 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/stack-8.8.2.yaml b/stack-8.8.2.yaml index 1800ece1df..0f63af7611 100644 --- a/stack-8.8.2.yaml +++ b/stack-8.8.2.yaml @@ -5,6 +5,7 @@ packages: - ./hie-compat - ./ghcide/ - ./hls-plugin-api + - ./hls-test-utils - ./shake-bench - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin @@ -76,8 +77,6 @@ extra-deps: - constraints-extras-0.3.0.2@sha256:013b8d0392582c6ca068e226718a4fe8be8e22321cc0634f6115505bf377ad26,1853 - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/stack-8.8.3.yaml b/stack-8.8.3.yaml index 93d8c13d19..7c904bc293 100644 --- a/stack-8.8.3.yaml +++ b/stack-8.8.3.yaml @@ -6,6 +6,7 @@ packages: - ./ghcide/ - ./shake-bench - ./hls-plugin-api + - ./hls-test-utils - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin - ./plugins/hls-eval-plugin @@ -70,8 +71,6 @@ extra-deps: - constraints-extras-0.3.0.2@sha256:013b8d0392582c6ca068e226718a4fe8be8e22321cc0634f6115505bf377ad26,1853 - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/stack-8.8.4.yaml b/stack-8.8.4.yaml index 2d33fcdecc..1cea93da82 100644 --- a/stack-8.8.4.yaml +++ b/stack-8.8.4.yaml @@ -6,6 +6,7 @@ packages: - ./ghcide/ - ./shake-bench - ./hls-plugin-api + - ./hls-test-utils - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin - ./plugins/hls-eval-plugin @@ -67,8 +68,6 @@ extra-deps: - constraints-extras-0.3.0.2@sha256:013b8d0392582c6ca068e226718a4fe8be8e22321cc0634f6115505bf377ad26,1853 - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/stack.yaml b/stack.yaml index 258d512164..d8a8f52f68 100644 --- a/stack.yaml +++ b/stack.yaml @@ -5,6 +5,7 @@ packages: - ./hie-compat - ./ghcide/ - ./hls-plugin-api + - ./hls-test-utils # - ./shake-bench - ./plugins/hls-class-plugin - ./plugins/hls-haddock-comments-plugin @@ -92,8 +93,6 @@ extra-deps: - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - resourcet-1.2.3 - # To avoid issue #1372 - - with-utf8-1.0.2.2 configure-options: ghcide: diff --git a/test/functional/Class.hs b/test/functional/Class.hs index 4ab13b6511..65658c464f 100644 --- a/test/functional/Class.hs +++ b/test/functional/Class.hs @@ -7,19 +7,12 @@ module Class ) where -import Control.Applicative.Combinators -import Control.Lens hiding ((<.>)) -import Control.Monad.IO.Class (MonadIO (liftIO)) -import qualified Data.ByteString.Lazy as BS -import qualified Data.Text.Encoding as T -import Language.LSP.Test -import Language.LSP.Types hiding (_command, _title) -import qualified Language.LSP.Types.Lens as J +import Control.Lens hiding ((<.>)) +import qualified Data.ByteString.Lazy as BS +import qualified Data.Text.Encoding as T +import qualified Language.LSP.Types.Lens as J import System.FilePath -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.Golden -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup @@ -65,18 +58,15 @@ classPath = "test" "testdata" "class" glodenTest :: String -> FilePath -> FilePath -> ([CodeAction] -> Session ()) -> TestTree glodenTest name fp deco execute - = goldenVsStringDiff name goldenGitDiff (classPath fpWithDeco <.> "expected" <.> "hs") + = goldenGitDiff name (classPath fpWithDeco <.> "expected" <.> "hs") $ runSession hlsCommand fullCaps classPath $ do doc <- openDoc (fp <.> "hs") "haskell" _ <- waitForDiagnosticsFromSource doc "typecheck" actions <- concatMap (^.. _CACodeAction) <$> getAllCodeActions doc execute actions - BS.fromStrict . T.encodeUtf8 <$> (skipManyTill anyMessage $ getDocumentEdit doc) + BS.fromStrict . T.encodeUtf8 <$> skipManyTill anyMessage (getDocumentEdit doc) where fpWithDeco | deco == "" = fp | otherwise = fp <.> deco - -goldenGitDiff :: FilePath -> FilePath -> [String] -goldenGitDiff fRef fNew = ["git", "diff", "--no-index", "--text", "--exit-code", fRef, fNew] diff --git a/test/functional/Command.hs b/test/functional/Command.hs index 4d5e67621f..5fb20c43c1 100644 --- a/test/functional/Command.hs +++ b/test/functional/Command.hs @@ -2,15 +2,11 @@ module Command (tests) where import Control.Lens hiding (List) -import Control.Monad.IO.Class import Data.Char import qualified Data.Text as T -import Language.LSP.Test import Language.LSP.Types as LSP import Language.LSP.Types.Lens as LSP -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup "commands" [ diff --git a/test/functional/Completion.hs b/test/functional/Completion.hs index 5caf585e5b..92b7883bf5 100644 --- a/test/functional/Completion.hs +++ b/test/functional/Completion.hs @@ -2,19 +2,12 @@ {-# LANGUAGE ScopedTypeVariables #-} module Completion(tests) where -import Control.Lens hiding ((.=)) -import Control.Monad.IO.Class -import Data.Aeson (object, (.=)) -import Data.Default (def) -import qualified Data.Text as T -import Ide.Plugin.Config (Config (maxCompletions)) -import Language.LSP.Test -import Language.LSP.Types -import Language.LSP.Types.Lens hiding (applyEdit) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import Control.Lens hiding ((.=)) +import Data.Aeson (object, (.=)) +import qualified Data.Text as T +import Ide.Plugin.Config (maxCompletions) +import Language.LSP.Types.Lens hiding (applyEdit) +import Test.Hls tests :: TestTree tests = testGroup "completions" [ diff --git a/test/functional/Config.hs b/test/functional/Config.hs index 70efc4bf86..d5a4c17cb5 100644 --- a/test/functional/Config.hs +++ b/test/functional/Config.hs @@ -2,22 +2,16 @@ module Config (tests) where -import Control.Applicative.Combinators (skipManyTill) -import Control.Lens hiding (List) +import Control.Lens hiding (List) import Control.Monad -import Control.Monad.IO.Class import Data.Aeson -import Data.Default -import qualified Data.Map as Map -import qualified Data.Text as T +import qualified Data.Map as Map +import qualified Data.Text as T import Ide.Plugin.Config -import Language.LSP.Test as Test -import Language.LSP.Types -import qualified Language.LSP.Types.Lens as L -import System.FilePath (()) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit +import Language.LSP.Test as Test +import qualified Language.LSP.Types.Lens as L +import System.FilePath (()) +import Test.Hls {-# ANN module ("HLint: ignore Reduce duplication"::String) #-} diff --git a/test/functional/Deferred.hs b/test/functional/Deferred.hs index ff15873d46..ace17a4cbe 100644 --- a/test/functional/Deferred.hs +++ b/test/functional/Deferred.hs @@ -3,19 +3,12 @@ {-# LANGUAGE OverloadedStrings #-} module Deferred(tests) where -import Control.Applicative.Combinators -import Control.Lens hiding (List) -import Control.Monad.IO.Class +import Control.Lens hiding (List) -- import Control.Monad -- import Data.Maybe -import Language.LSP.Test -import Language.LSP.Types -import Language.LSP.Types.Lens hiding (id, message) +import Language.LSP.Types.Lens hiding (id, message) -- import qualified Language.LSP.Types.Lens as LSP -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree diff --git a/test/functional/Definition.hs b/test/functional/Definition.hs index c902d4e94a..67beba9e56 100644 --- a/test/functional/Definition.hs +++ b/test/functional/Definition.hs @@ -1,15 +1,9 @@ module Definition (tests) where import Control.Lens -import Control.Monad.IO.Class -import Language.LSP.Test -import Language.LSP.Types import Language.LSP.Types.Lens import System.Directory -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup "definitions" [ diff --git a/test/functional/Diagnostic.hs b/test/functional/Diagnostic.hs index 620401856c..3966de9545 100644 --- a/test/functional/Diagnostic.hs +++ b/test/functional/Diagnostic.hs @@ -2,19 +2,12 @@ module Diagnostic (tests) where -import Control.Applicative.Combinators -import Control.Lens hiding (List) -import Control.Monad.IO.Class -import Data.Aeson (toJSON) +import Control.Lens hiding (List) +import Data.Aeson (toJSON) import qualified Data.Default import Ide.Plugin.Config -import Language.LSP.Test hiding (message) -import Language.LSP.Types -import qualified Language.LSP.Types.Lens as LSP -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import qualified Language.LSP.Types.Lens as LSP +import Test.Hls -- --------------------------------------------------------------------- diff --git a/test/functional/Format.hs b/test/functional/Format.hs index 8936c666d9..4b2c201a1e 100644 --- a/test/functional/Format.hs +++ b/test/functional/Format.hs @@ -11,18 +11,15 @@ import qualified Data.Text.IO as T import Language.LSP.Test import Language.LSP.Types import qualified Language.LSP.Types.Lens as LSP -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.Golden -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup "format document" [ - goldenVsStringDiff "works" goldenGitDiff "test/testdata/format/Format.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + goldenGitDiff "works" "test/testdata/format/Format.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "works with custom tab size" goldenGitDiff "test/testdata/format/Format.formatted_document_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + , goldenGitDiff "works with custom tab size" "test/testdata/format/Format.formatted_document_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 5 True Nothing Nothing Nothing) BS.fromStrict . T.encodeUtf8 <$> documentContents doc @@ -34,11 +31,11 @@ tests = testGroup "format document" [ rangeTests :: TestTree rangeTests = testGroup "format range" [ - goldenVsStringDiff "works" goldenGitDiff "test/testdata/format/Format.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + goldenGitDiff "works" "test/testdata/format/Format.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatRange doc (FormattingOptions 2 True Nothing Nothing Nothing) (Range (Position 5 0) (Position 7 10)) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "works with custom tab size" goldenGitDiff "test/testdata/format/Format.formatted_range_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + , goldenGitDiff "works with custom tab size" "test/testdata/format/Format.formatted_range_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatRange doc (FormattingOptions 5 True Nothing Nothing Nothing) (Range (Position 8 0) (Position 11 19)) BS.fromStrict . T.encodeUtf8 <$> documentContents doc @@ -49,7 +46,7 @@ providerTests = testGroup "formatting provider" [ testCase "respects none" $ runSessionWithConfig (formatConfig "none") hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" resp <- request STextDocumentFormatting $ DocumentFormattingParams Nothing doc (FormattingOptions 2 True Nothing Nothing Nothing) - liftIO $ resp ^. LSP.result @?= (Left $ ResponseError InvalidRequest "No plugin enabled for STextDocumentFormatting, available: []" Nothing) + liftIO $ resp ^. LSP.result @?= Left (ResponseError InvalidRequest "No plugin enabled for STextDocumentFormatting, available: []" Nothing) , testCase "respects initial" $ runSessionWithConfig (formatConfig "floskell") hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" @@ -93,12 +90,12 @@ providerTests = testGroup "formatting provider" [ ormoluTests :: TestTree ormoluTests = testGroup "ormolu" - [ goldenVsStringDiff "formats correctly" goldenGitDiff "test/testdata/format/Format.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + [ goldenGitDiff "formats correctly" "test/testdata/format/Format.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu")) doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats imports correctly" goldenGitDiff "test/testdata/format/Format2.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + , goldenGitDiff "formats imports correctly" "test/testdata/format/Format2.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu")) doc <- openDoc "Format2.hs" "haskell" formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing) @@ -107,12 +104,12 @@ ormoluTests = testGroup "ormolu" fourmoluTests :: TestTree fourmoluTests = testGroup "fourmolu" - [ goldenVsStringDiff "formats correctly" goldenGitDiff "test/testdata/format/Format.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + [ goldenGitDiff "formats correctly" "test/testdata/format/Format.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "fourmolu")) doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats imports correctly" goldenGitDiff "test/testdata/format/Format2.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + , goldenGitDiff "formats imports correctly" "test/testdata/format/Format2.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "fourmolu")) doc <- openDoc "Format2.hs" "haskell" formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing) @@ -128,6 +125,3 @@ formatLspConfigOld provider = object [ "languageServerHaskell" .= object ["forma formatConfig :: Value -> SessionConfig formatConfig provider = defaultConfig { lspConfig = Just (formatLspConfig provider) } - -goldenGitDiff :: FilePath -> FilePath -> [String] -goldenGitDiff fRef fNew = ["git", "diff", "--no-index", "--text", "--exit-code", fRef, fNew] diff --git a/test/functional/FunctionalBadProject.hs b/test/functional/FunctionalBadProject.hs index b84b19db4b..6d4d68206f 100644 --- a/test/functional/FunctionalBadProject.hs +++ b/test/functional/FunctionalBadProject.hs @@ -8,9 +8,7 @@ module FunctionalBadProject (tests) where -- import Language.LSP.Test hiding (message) -- import Language.LSP.Types as LSP -- import Language.LSP.Types.Lens as LSP hiding (contents, error ) --- import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit +import Test.Hls -- --------------------------------------------------------------------- -- TODO: Currently this can not succeed, since such an error is thrown in "runActionWithContext" which diff --git a/test/functional/FunctionalCodeAction.hs b/test/functional/FunctionalCodeAction.hs index f9d4fe8376..358f9d9768 100644 --- a/test/functional/FunctionalCodeAction.hs +++ b/test/functional/FunctionalCodeAction.hs @@ -6,30 +6,22 @@ module FunctionalCodeAction (tests) where -import Control.Applicative.Combinators import Control.Lens hiding (List) import Control.Monad -import Control.Monad.IO.Class import Data.Aeson -import Data.Default import qualified Data.HashMap.Strict as HM import Data.List import Data.Maybe import qualified Data.Text as T import Ide.Plugin.Config import Language.LSP.Test as Test -import Language.LSP.Types import qualified Language.LSP.Types.Capabilities as C import qualified Language.LSP.Types.Lens as L -import Test.Hls.Util +import Test.Hls import Test.Hspec.Expectations import System.FilePath (()) import System.IO.Extra (withTempDir) -import Test.Tasty -import Test.Tasty.ExpectedFailure (expectFailBecause, - ignoreTestBecause) -import Test.Tasty.HUnit {-# ANN module ("HLint: ignore Reduce duplication"::String) #-} diff --git a/test/functional/FunctionalLiquid.hs b/test/functional/FunctionalLiquid.hs index bec5264786..99a36eb607 100644 --- a/test/functional/FunctionalLiquid.hs +++ b/test/functional/FunctionalLiquid.hs @@ -2,19 +2,11 @@ module FunctionalLiquid (tests) where -import Control.Lens hiding (List) -import Control.Monad.IO.Class +import Control.Lens hiding (List) import Data.Aeson -import Data.Default import Ide.Plugin.Config -import Language.LSP.Test hiding (message) -import Language.LSP.Types as LSP -import Language.LSP.Types.Lens as LSP hiding (contents) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit - +import Language.LSP.Types.Lens as LSP hiding (contents) +import Test.Hls -- --------------------------------------------------------------------- tests :: TestTree diff --git a/test/functional/HaddockComments.hs b/test/functional/HaddockComments.hs index 5f88064f86..6b3b0cdff3 100644 --- a/test/functional/HaddockComments.hs +++ b/test/functional/HaddockComments.hs @@ -11,19 +11,13 @@ module HaddockComments ) where -import Control.Monad.IO.Class (liftIO) -import qualified Data.ByteString.Lazy as LBS -import Data.Foldable (find) -import Data.Maybe (mapMaybe) -import Data.Text (Text) -import Data.Text.Encoding (encodeUtf8) -import Language.LSP.Test -import Language.LSP.Types -import System.FilePath ((<.>), ()) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.Golden -import Test.Tasty.HUnit +import qualified Data.ByteString.Lazy as LBS +import Data.Foldable (find) +import Data.Maybe (mapMaybe) +import Data.Text (Text) +import Data.Text.Encoding (encodeUtf8) +import System.FilePath ((<.>), ()) +import Test.Hls tests :: TestTree tests = @@ -40,7 +34,7 @@ tests = ] goldenTest :: FilePath -> GenCommentsType -> Int -> Int -> TestTree -goldenTest fp (toTitle -> expectedTitle) l c = goldenVsStringDiff (fp <> " (golden)") goldenGitDiff goldenFilePath $ +goldenTest fp (toTitle -> expectedTitle) l c = goldenGitDiff (fp <> " (golden)") goldenFilePath $ runSession hlsCommand fullCaps haddockCommentsPath $ do doc <- openDoc hsFilePath "haskell" _ <- waitForDiagnostics @@ -75,5 +69,3 @@ caTitle _ = Nothing haddockCommentsPath :: String haddockCommentsPath = "test" "testdata" "haddockComments" -goldenGitDiff :: FilePath -> FilePath -> [String] -goldenGitDiff fRef fNew = ["git", "diff", "--no-index", "--text", "--exit-code", fRef, fNew] diff --git a/test/functional/HieBios.hs b/test/functional/HieBios.hs index f58bda3fb1..11f5163cd4 100644 --- a/test/functional/HieBios.hs +++ b/test/functional/HieBios.hs @@ -4,13 +4,10 @@ module HieBios (tests) where import Control.Lens ((^.)) import Control.Monad.IO.Class import qualified Data.Text as T -import Language.LSP.Test -import Language.LSP.Types import qualified Language.LSP.Types.Lens as L import System.FilePath (()) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit +import Test.Hls + tests :: TestTree tests = testGroup "hie-bios" [ diff --git a/test/functional/Highlight.hs b/test/functional/Highlight.hs index a92e6e2686..ec518d956e 100644 --- a/test/functional/Highlight.hs +++ b/test/functional/Highlight.hs @@ -1,12 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Highlight (tests) where -import Control.Monad.IO.Class -import Language.LSP.Test -import Language.LSP.Types -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup "highlight" [ diff --git a/test/functional/Main.hs b/test/functional/Main.hs index b865f96cf1..2ae16e5f37 100644 --- a/test/functional/Main.hs +++ b/test/functional/Main.hs @@ -7,7 +7,6 @@ import Config import Deferred import Definition import Diagnostic -import Eval import Format import FunctionalBadProject import FunctionalCodeAction @@ -21,19 +20,11 @@ import Reference import Rename import Splice import Symbol -import Test.Tasty -import Test.Tasty.Ingredients.Rerun -import Test.Tasty.Runners (consoleTestReporter, - listingTests) -import Test.Tasty.Runners.AntXML +import Test.Hls import TypeDefinition main :: IO () -main = - -- ingredient: xml runner writes json file of test results (https://github.com/ocharles/tasty-ant-xml/blob/master/Test/Tasty/Runners/AntXML.hs) - -- rerunningTests allow rerun of failed tests (https://github.com/ocharles/tasty-rerun/blob/master/src/Test/Tasty/Ingredients/Rerun.hs) - defaultMainWithIngredients - [antXMLRunner, rerunningTests [listingTests, consoleTestReporter]] +main = defaultTestRunner $ testGroup "haskell-language-server" [ Class.tests @@ -43,7 +34,6 @@ main = , Deferred.tests , Definition.tests , Diagnostic.tests - , Eval.tests , Format.tests , FunctionalBadProject.tests , FunctionalCodeAction.tests diff --git a/test/functional/ModuleName.hs b/test/functional/ModuleName.hs index b45aef34a2..077d4cb35b 100644 --- a/test/functional/ModuleName.hs +++ b/test/functional/ModuleName.hs @@ -1,24 +1,15 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DuplicateRecordFields #-} - +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} + module ModuleName ( tests ) where -import Control.Applicative.Combinators (skipManyTill) -import Control.Monad.IO.Class (MonadIO (liftIO)) -import qualified Data.Text.IO as T -import Language.LSP.Test (anyMessage, documentContents, - executeCommand, fullCaps, - getCodeLenses, message, - openDoc, runSession) -import Language.LSP.Types -import System.FilePath ((<.>), ()) -import Test.Hls.Util (hlsCommand) -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.HUnit (testCase, (@?=)) +import qualified Data.Text.IO as T +import System.FilePath ((<.>), ()) +import Test.Hls tests :: TestTree tests = testGroup diff --git a/test/functional/Progress.hs b/test/functional/Progress.hs index 31d0680276..3e5c6d186f 100644 --- a/test/functional/Progress.hs +++ b/test/functional/Progress.hs @@ -7,25 +7,17 @@ module Progress (tests) where -import Control.Applicative.Combinators import Control.Lens hiding ((.=)) -import Control.Monad.IO.Class import Data.Aeson (Value, decode, encode, object, toJSON, (.=)) -import Data.Default import Data.List (delete) import Data.Maybe (fromJust) import Data.Text (Text, pack) import Ide.Plugin.Config -import Language.LSP.Test -import Language.LSP.Types import Language.LSP.Types.Capabilities import qualified Language.LSP.Types.Lens as L import System.FilePath (()) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = diff --git a/test/functional/Reference.hs b/test/functional/Reference.hs index 26eb5571ef..994e1b6082 100644 --- a/test/functional/Reference.hs +++ b/test/functional/Reference.hs @@ -1,16 +1,10 @@ module Reference (tests) where import Control.Lens -import Control.Monad.IO.Class import Data.Coerce import Data.List -import Language.LSP.Test -import Language.LSP.Types import Language.LSP.Types.Lens -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup "references" [ diff --git a/test/functional/Rename.hs b/test/functional/Rename.hs index 98fbed1a57..aa6272e2a4 100644 --- a/test/functional/Rename.hs +++ b/test/functional/Rename.hs @@ -1,13 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Rename (tests) where -import Control.Monad.IO.Class (liftIO) -import Language.LSP.Test -import Language.LSP.Types -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup "rename" [ diff --git a/test/functional/Splice.hs b/test/functional/Splice.hs index ad28d8040d..7f17cab0ca 100644 --- a/test/functional/Splice.hs +++ b/test/functional/Splice.hs @@ -8,22 +8,16 @@ module Splice (tests) where -import Control.Applicative.Combinators import Control.Monad -import Control.Monad.IO.Class -import Data.List (find) -import Data.Text (Text) -import qualified Data.Text as T -import qualified Data.Text.IO as T +import Data.List (find) +import Data.Text (Text) +import qualified Data.Text as T +import qualified Data.Text.IO as T import Ide.Plugin.Splice.Types -import Language.LSP.Test -import Language.LSP.Types import System.Directory import System.FilePath -import System.Time.Extra (sleep) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit +import System.Time.Extra (sleep) +import Test.Hls tests :: TestTree tests = diff --git a/test/functional/Symbol.hs b/test/functional/Symbol.hs index 2dba0bd65b..78fae0bf4b 100644 --- a/test/functional/Symbol.hs +++ b/test/functional/Symbol.hs @@ -2,16 +2,11 @@ module Symbol (tests) where import Control.Lens (_Just, ix, to, (^?)) -import Control.Monad.IO.Class import Data.List import Language.LSP.Test as Test -import Language.LSP.Types import Language.LSP.Types.Capabilities import qualified Language.LSP.Types.Lens as L -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.ExpectedFailure (ignoreTestBecause) -import Test.Tasty.HUnit +import Test.Hls tests :: TestTree tests = testGroup "document symbols" [ diff --git a/test/functional/TypeDefinition.hs b/test/functional/TypeDefinition.hs index 4f5d780f3a..b56198c62d 100644 --- a/test/functional/TypeDefinition.hs +++ b/test/functional/TypeDefinition.hs @@ -1,13 +1,8 @@ module TypeDefinition (tests) where -import Control.Monad.IO.Class -import Data.Tuple.Extra (first3) -import Language.LSP.Test -import Language.LSP.Types -import System.FilePath (()) -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit +import Data.Tuple.Extra (first3) +import System.FilePath (()) +import Test.Hls tests :: TestTree tests = testGroup "type definitions" [ diff --git a/test/wrapper/Main.hs b/test/wrapper/Main.hs index b91dd5b5a3..576471b9e3 100644 --- a/test/wrapper/Main.hs +++ b/test/wrapper/Main.hs @@ -1,20 +1,13 @@ -import Data.List.Extra (trimEnd) +import Data.List.Extra (trimEnd) import Data.Maybe import System.Environment import System.Process -import Test.Hls.Util -import Test.Tasty -import Test.Tasty.HUnit -import Test.Tasty.Ingredients.Rerun -import Test.Tasty.Runners (consoleTestReporter, - listingTests) +import Test.Hls main :: IO () main = do flushStackEnvironment - defaultMainWithIngredients - [rerunningTests [listingTests, consoleTestReporter]] $ - testGroup "haskell-language-server-wrapper" [projectGhcVersionTests] + defaultTestRunner $ testGroup "haskell-language-server-wrapper" [projectGhcVersionTests] projectGhcVersionTests :: TestTree projectGhcVersionTests = testGroup "--project-ghc-version"