Skip to content

Commit 111ad4c

Browse files
authored
Move ghcide-test to stand alone dir (#4520)
* Add multiple new Haskell modules and configuration files * Fix directory paths for test data and source directories * Remove unnecessary test data files from the cabal configuration * fix test data dir * Add ghcide-test-preprocessor executable and update cabal configuration * Remove ghcide-test-preprocessor executable and associated flag from cabal configuration * Update test-suite dependencies to reference the correct executable * Remove ghcide-test-preprocessor from func-test dependencies * Add additional test data files to cabal configuration
1 parent 9cca428 commit 111ad4c

File tree

142 files changed

+26
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+26
-28
lines changed

ghcide-bench/src/Experiments.hs

-3
Original file line numberDiff line numberDiff line change
@@ -857,11 +857,9 @@ getBuildEdgesCount = tryCallTestPlugin GetBuildEdgesCount
857857
getRebuildsCount :: Session (Either (TResponseError @ClientToServer (Method_CustomMethod "test")) Int)
858858
getRebuildsCount = tryCallTestPlugin GetRebuildsCount
859859

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

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

876-
-- Copy&paste from ghcide/test/Development.IDE.Test
877874
callTestPlugin :: (A.FromJSON b) => TestRequest -> Session b
878875
callTestPlugin cmd = do
879876
res <- tryCallTestPlugin cmd
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.
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.

ghcide/test/exe/Config.hs ghcide-test/exe/Config.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module Config(
2828
, withLongTimeout
2929
, lspTestCaps
3030
, lspTestCapsNoFileWatches
31+
, testDataDir
3132
) where
3233

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

4950
testDataDir :: FilePath
50-
testDataDir = "ghcide" </> "test" </> "data"
51+
testDataDir = "ghcide-test" </> "data"
5152

5253
mkIdeTestFs :: [FS.FileTree] -> FS.VirtualFileTree
5354
mkIdeTestFs = FS.mkVirtualFileTree testDataDir
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.

ghcide/test/exe/NonLspCommandLine.hs ghcide-test/exe/NonLspCommandLine.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import System.Process.Extra (CreateProcess (cwd), proc,
1414
readCreateProcessWithExitCode)
1515
import Test.Tasty
1616
import Test.Tasty.HUnit
17+
import Config (testDataDir)
1718

1819

1920
-- A test to ensure that the command line ghcide workflow stays working
@@ -44,7 +45,7 @@ withTempDir f = System.IO.Extra.withTempDir $ canonicalizePath >=> f
4445
copyTestDataFiles :: FilePath -> FilePath -> IO ()
4546
copyTestDataFiles dir prefix = do
4647
-- Copy all the test data files to the temporary workspace
47-
testDataFiles <- getDirectoryFilesIO ("ghcide/test/data" </> prefix) ["//*"]
48+
testDataFiles <- getDirectoryFilesIO (testDataDir </> prefix) ["//*"]
4849
for_ testDataFiles $ \f -> do
4950
createDirectoryIfMissing True $ dir </> takeDirectory f
50-
copyFile ("ghcide/test/data" </> prefix </> f) (dir </> f)
51+
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ghcide/ghcide.cabal

-19
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8
1818
extra-source-files:
1919
CHANGELOG.md
2020
README.md
21-
test/data/**/*.cabal
22-
test/data/**/*.hs
23-
test/data/**/*.hs-boot
24-
test/data/**/*.project
25-
test/data/**/*.yaml
2621

2722
source-repository head
2823
type: git
@@ -212,20 +207,6 @@ library
212207
ghc-options:
213208
-Werror
214209

215-
flag test-exe
216-
description: Build the ghcide-test-preprocessor executable
217-
default: True
218-
219-
executable ghcide-test-preprocessor
220-
import: warnings
221-
default-language: GHC2021
222-
hs-source-dirs: test/preprocessor
223-
main-is: Main.hs
224-
build-depends: base >=4 && <5
225-
226-
if !flag(test-exe)
227-
buildable: False
228-
229210
flag executable
230211
description: Build the ghcide executable
231212
default: True

haskell-language-server.cabal

+21-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ extra-source-files:
3232
plugins/**/*.txt
3333
plugins/**/*.hs
3434

35+
ghcide-test/data/**/*.cabal
36+
ghcide-test/data/**/*.hs
37+
ghcide-test/data/**/*.hs-boot
38+
ghcide-test/data/**/*.project
39+
ghcide-test/data/**/*.yaml
40+
3541
bindist/wrapper.in
3642

3743
source-repository head
@@ -2027,7 +2033,6 @@ test-suite func-test
20272033
type: exitcode-stdio-1.0
20282034
build-tool-depends:
20292035
haskell-language-server:haskell-language-server,
2030-
ghcide:ghcide-test-preprocessor
20312036

20322037
build-depends:
20332038
, aeson
@@ -2124,14 +2129,27 @@ benchmark benchmark
21242129
, text
21252130
, yaml
21262131

2132+
flag test-exe
2133+
description: Build the ghcide-test-preprocessor executable
2134+
default: True
2135+
2136+
executable ghcide-test-preprocessor
2137+
import: warnings
2138+
default-language: GHC2021
2139+
hs-source-dirs: ghcide-test/preprocessor
2140+
main-is: Main.hs
2141+
build-depends: base >=4 && <5
2142+
2143+
if !flag(test-exe)
2144+
buildable: False
21272145

21282146
test-suite ghcide-tests
21292147
import: warnings
21302148
type: exitcode-stdio-1.0
21312149
default-language: GHC2021
21322150
build-tool-depends:
21332151
, ghcide:ghcide
2134-
, ghcide:ghcide-test-preprocessor
2152+
, haskell-language-server:ghcide-test-preprocessor
21352153
, implicit-hie:gen-hie
21362154

21372155
build-depends:
@@ -2174,7 +2192,7 @@ test-suite ghcide-tests
21742192
if impl(ghc <9.3)
21752193
build-depends: ghc-typelits-knownnat
21762194

2177-
hs-source-dirs: ghcide/test/exe
2195+
hs-source-dirs: ghcide-test/exe
21782196
ghc-options: -threaded -O0
21792197

21802198
main-is: Main.hs

0 commit comments

Comments
 (0)