From 62e481a24fff14d4a45204bc1b914487d509be3d Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 19 May 2024 11:29:26 +0800 Subject: [PATCH] runInDir that do not shift the root --- ghcide/test/exe/Config.hs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ghcide/test/exe/Config.hs b/ghcide/test/exe/Config.hs index 8297436781..9d9a1cd13b 100644 --- a/ghcide/test/exe/Config.hs +++ b/ghcide/test/exe/Config.hs @@ -63,7 +63,7 @@ runWithDummyPlugin' :: FS.VirtualFileTree -> (FilePath -> Session a) -> IO a runWithDummyPlugin' fs = runSessionWithTestConfig def { testPluginDescriptor = dummyPlugin , testDirLocation = Right fs - , testConfigCaps = lspTestCaps + , testConfigCaps = lspTestCaps , testShiftRoot = True } @@ -88,19 +88,18 @@ testWithExtraFiles :: String -> String -> (FilePath -> Session ()) -> TestTree testWithExtraFiles testName dirName action = testCase testName $ runWithExtraFiles dirName action runInDir :: FilePath -> Session a -> IO a -runInDir fs = runSessionWithServer def dummyPlugin fs - -testSession' :: TestName -> (FilePath -> Session ()) -> TestTree -testSession' name = testCase name . run' +runInDir fp = + runSessionWithTestConfig def { + testShiftRoot = False + , testPluginDescriptor=dummyPlugin + , testDirLocation = Left fp + } . const run :: Session a -> IO a run = runSessionWithTestConfig def {testDirLocation=Right (mkIdeTestFs []), testPluginDescriptor=dummyPlugin} . const -run' :: (FilePath -> Session a) -> IO a -run' = runSessionWithTestConfig def {testDirLocation=Right (mkIdeTestFs []), testPluginDescriptor=dummyPlugin} - pattern R :: UInt -> UInt -> UInt -> UInt -> Range pattern R x y x' y' = Range (Position x y) (Position x' y')