Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ghcide-test to stand alone dir #4520

Merged
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
3 changes: 0 additions & 3 deletions ghcide-bench/src/Experiments.hs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
examplesPath = "bench/example"

defConfig :: Config
Success defConfig = execParserPure defaultPrefs (info configP fullDesc) []

Check warning on line 345 in ghcide-bench/src/Experiments.hs

View workflow job for this annotation

GitHub Actions / flags (9.6, ubuntu-latest)

Pattern match(es) are non-exhaustive

Check warning on line 345 in ghcide-bench/src/Experiments.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Pattern match(es) are non-exhaustive

Check warning on line 345 in ghcide-bench/src/Experiments.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Pattern match(es) are non-exhaustive

quiet, verbose :: Config -> Bool
verbose = (== All) . verbosity
Expand Down Expand Up @@ -857,11 +857,9 @@
getRebuildsCount :: Session (Either (TResponseError @ClientToServer (Method_CustomMethod "test")) Int)
getRebuildsCount = tryCallTestPlugin GetRebuildsCount

-- Copy&paste from ghcide/test/Development.IDE.Test
getStoredKeys :: Session [Text]
getStoredKeys = callTestPlugin GetStoredKeys

-- Copy&paste from ghcide/test/Development.IDE.Test
tryCallTestPlugin :: (A.FromJSON b) => TestRequest -> Session (Either (TResponseError @ClientToServer (Method_CustomMethod "test")) b)
tryCallTestPlugin cmd = do
let cm = SMethod_CustomMethod (Proxy @"test")
Expand All @@ -873,7 +871,6 @@
A.Success a -> Right a
A.Error e -> error e

-- Copy&paste from ghcide/test/Development.IDE.Test
callTestPlugin :: (A.FromJSON b) => TestRequest -> Session b
callTestPlugin cmd = do
res <- tryCallTestPlugin cmd
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion ghcide/test/exe/Config.hs → ghcide-test/exe/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module Config(
, withLongTimeout
, lspTestCaps
, lspTestCapsNoFileWatches
, testDataDir
) where

import Control.Exception (bracket_)
Expand All @@ -47,7 +48,7 @@ import Test.Hls
import qualified Test.Hls.FileSystem as FS

testDataDir :: FilePath
testDataDir = "ghcide" </> "test" </> "data"
testDataDir = "ghcide-test" </> "data"

mkIdeTestFs :: [FS.FileTree] -> FS.VirtualFileTree
mkIdeTestFs = FS.mkVirtualFileTree testDataDir
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import System.Process.Extra (CreateProcess (cwd), proc,
readCreateProcessWithExitCode)
import Test.Tasty
import Test.Tasty.HUnit
import Config (testDataDir)


-- A test to ensure that the command line ghcide workflow stays working
Expand Down Expand Up @@ -44,7 +45,7 @@ withTempDir f = System.IO.Extra.withTempDir $ canonicalizePath >=> f
copyTestDataFiles :: FilePath -> FilePath -> IO ()
copyTestDataFiles dir prefix = do
-- Copy all the test data files to the temporary workspace
testDataFiles <- getDirectoryFilesIO ("ghcide/test/data" </> prefix) ["//*"]
testDataFiles <- getDirectoryFilesIO (testDataDir </> prefix) ["//*"]
for_ testDataFiles $ \f -> do
createDirectoryIfMissing True $ dir </> takeDirectory f
copyFile ("ghcide/test/data" </> prefix </> f) (dir </> f)
copyFile (testDataDir </> prefix </> f) (dir </> f)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 0 additions & 19 deletions ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8
extra-source-files:
CHANGELOG.md
README.md
test/data/**/*.cabal
test/data/**/*.hs
test/data/**/*.hs-boot
test/data/**/*.project
test/data/**/*.yaml

source-repository head
type: git
Expand Down Expand Up @@ -212,20 +207,6 @@ library
ghc-options:
-Werror

flag test-exe
description: Build the ghcide-test-preprocessor executable
default: True

executable ghcide-test-preprocessor
import: warnings
default-language: GHC2021
hs-source-dirs: test/preprocessor
main-is: Main.hs
build-depends: base >=4 && <5

if !flag(test-exe)
buildable: False

flag executable
description: Build the ghcide executable
default: True
Expand Down
24 changes: 21 additions & 3 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ extra-source-files:
plugins/**/*.txt
plugins/**/*.hs

ghcide-test/data/**/*.cabal
ghcide-test/data/**/*.hs
ghcide-test/data/**/*.hs-boot
ghcide-test/data/**/*.project
ghcide-test/data/**/*.yaml

bindist/wrapper.in

source-repository head
Expand Down Expand Up @@ -2027,7 +2033,6 @@ test-suite func-test
type: exitcode-stdio-1.0
build-tool-depends:
haskell-language-server:haskell-language-server,
ghcide:ghcide-test-preprocessor

build-depends:
, aeson
Expand Down Expand Up @@ -2124,14 +2129,27 @@ benchmark benchmark
, text
, yaml

flag test-exe
description: Build the ghcide-test-preprocessor executable
default: True

executable ghcide-test-preprocessor
import: warnings
default-language: GHC2021
hs-source-dirs: ghcide-test/preprocessor
main-is: Main.hs
build-depends: base >=4 && <5

if !flag(test-exe)
buildable: False

test-suite ghcide-tests
import: warnings
type: exitcode-stdio-1.0
default-language: GHC2021
build-tool-depends:
, ghcide:ghcide
, ghcide:ghcide-test-preprocessor
, haskell-language-server:ghcide-test-preprocessor
, implicit-hie:gen-hie

build-depends:
Expand Down Expand Up @@ -2174,7 +2192,7 @@ test-suite ghcide-tests
if impl(ghc <9.3)
build-depends: ghc-typelits-knownnat

hs-source-dirs: ghcide/test/exe
hs-source-dirs: ghcide-test/exe
ghc-options: -threaded -O0

main-is: Main.hs
Expand Down
Loading