Skip to content

Commit 9f3e274

Browse files
authored
Delete testUtil from ghcide-tests (#4272)
1 parent 00b6d36 commit 9f3e274

File tree

5 files changed

+23
-209
lines changed

5 files changed

+23
-209
lines changed

ghcide/test/exe/Config.hs

-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import Control.Lens.Setter ((.~))
3333
import Data.Foldable (traverse_)
3434
import Data.Function ((&))
3535
import qualified Data.Text as T
36-
import Development.IDE (Pretty)
3736
import Development.IDE.Test (canonicalizeUri)
3837
import Ide.Types (defaultPluginDescriptor)
3938
import qualified Language.LSP.Protocol.Lens as L
@@ -90,20 +89,12 @@ testWithExtraFiles testName dirName action = testCase testName $ runWithExtraFil
9089
runInDir :: FilePath -> Session a -> IO a
9190
runInDir fs = runSessionWithServer def dummyPlugin fs
9291

93-
testSession' :: TestName -> (FilePath -> Session ()) -> TestTree
94-
testSession' name = testCase name . run'
95-
9692
run :: Session a -> IO a
9793
run = runSessionWithTestConfig def
9894
{ testDirLocation = Right (mkIdeTestFs [])
9995
, testPluginDescriptor = dummyPlugin }
10096
. const
10197

102-
run' :: (FilePath -> Session a) -> IO a
103-
run' = runSessionWithTestConfig def
104-
{ testDirLocation = Right (mkIdeTestFs [])
105-
, testPluginDescriptor = dummyPlugin }
106-
10798
pattern R :: UInt -> UInt -> UInt -> UInt -> Range
10899
pattern R x y x' y' = Range (Position x y) (Position x' y')
109100

ghcide/test/exe/CradleTests.hs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import System.FilePath
2626
import System.IO.Extra hiding (withTempDir)
2727
-- import Test.QuickCheck.Instances ()
2828
import Config
29-
import Config (checkDefs, mkL)
3029
import Control.Lens ((^.))
3130
import Development.IDE.Plugin.Test (WaitForIdeRuleResult (..))
3231
import GHC.TypeLits (symbolVal)

ghcide/test/exe/NonLspCommandLine.hs

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11

22
module NonLspCommandLine (tests) where
33

4+
import Control.Monad ((>=>))
5+
import Data.Foldable (for_)
46
import Development.IDE.Test.Runfiles
7+
import Development.Shake (getDirectoryFilesIO)
8+
import System.Directory (copyFile,
9+
createDirectoryIfMissing)
10+
import System.Directory.Extra (canonicalizePath)
511
import System.Environment.Blank (setEnv)
612
import System.Exit (ExitCode (ExitSuccess))
13+
import System.FilePath (takeDirectory, (</>))
14+
import qualified System.IO.Extra
715
import System.Process.Extra (CreateProcess (cwd), proc,
816
readCreateProcessWithExitCode)
917
import Test.Tasty
1018
import Test.Tasty.HUnit
11-
import TestUtils
1219

1320

1421
-- A test to ensure that the command line ghcide workflow stays working
@@ -25,3 +32,18 @@ tests = testGroup "ghcide command line"
2532

2633
ec @?= ExitSuccess
2734
]
35+
36+
-- | Version of 'System.IO.Extra.withTempDir' that canonicalizes the path
37+
-- Which we need to do on macOS since the $TMPDIR can be in @/private/var@ or
38+
-- @/var@
39+
withTempDir :: (FilePath -> IO a) -> IO a
40+
withTempDir f = System.IO.Extra.withTempDir $ canonicalizePath >=> f
41+
42+
43+
copyTestDataFiles :: FilePath -> FilePath -> IO ()
44+
copyTestDataFiles dir prefix = do
45+
-- Copy all the test data files to the temporary workspace
46+
testDataFiles <- getDirectoryFilesIO ("ghcide/test/data" </> prefix) ["//*"]
47+
for_ testDataFiles $ \f -> do
48+
createDirectoryIfMissing True $ dir </> takeDirectory f
49+
copyFile ("ghcide/test/data" </> prefix </> f) (dir </> f)

ghcide/test/exe/TestUtils.hs

-197
This file was deleted.

haskell-language-server.cabal

-1
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,6 @@ test-suite ghcide-tests
21752175
RootUriTests
21762176
SafeTests
21772177
SymlinkTests
2178-
TestUtils
21792178
THTests
21802179
UnitTests
21812180
WatchedFileTests

0 commit comments

Comments
 (0)