Skip to content

Commit

Permalink
runInDir that do not shift the root
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed May 19, 2024
1 parent bc9cb69 commit 62e481a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions ghcide/test/exe/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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')

Expand Down

0 comments on commit 62e481a

Please sign in to comment.