File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -15,17 +15,17 @@ import Language.LSP.Protocol.Types hiding
1515 mkRange )
1616import Language.LSP.Test
1717-- import Test.QuickCheck.Instances ()
18+ import Config
1819import Development.IDE.Plugin.Test (TestRequest (BlockSeconds ),
1920 blockCommandId )
2021import Test.Tasty
2122import Test.Tasty.HUnit
22- import TestUtils
2323
2424-- | Test if ghcide asynchronously handles Commands and user Requests
2525tests :: TestTree
2626tests = testGroup " async"
2727 [
28- testSession " command" $ do
28+ testWithDummyPluginEmpty " command" $ do
2929 -- Execute a command that will block forever
3030 let req = ExecuteCommandParams Nothing blockCommandId Nothing
3131 void $ sendRequest SMethod_WorkspaceExecuteCommand req
@@ -38,7 +38,7 @@ tests = testGroup "async"
3838 codeLenses <- getAndResolveCodeLenses doc
3939 liftIO $ [ _title | CodeLens {_command = Just Command {_title}} <- codeLenses] @=?
4040 [ " foo :: a -> a" ]
41- , testSession " request" $ do
41+ , testWithDummyPluginEmpty " request" $ do
4242 -- Execute a custom request that will block for 1000 seconds
4343 void $ sendRequest (SMethod_CustomMethod (Proxy @ " test" )) $ toJSON $ BlockSeconds 1000
4444 -- Load a file and check for code actions. Will only work if the request is run asynchronously
Original file line number Diff line number Diff line change @@ -31,5 +31,14 @@ testWithDummyPlugin caseName vfs = testCase caseName . runWithDummyPlugin vfs
3131testWithDummyPlugin' :: String -> FS. VirtualFileTree -> (FileSystem -> Session () ) -> TestTree
3232testWithDummyPlugin' caseName vfs = testCase caseName . runWithDummyPlugin' vfs
3333
34+ runWithDummyPluginEmpty :: Session a -> IO a
35+ runWithDummyPluginEmpty = runWithDummyPlugin $ mkIdeTestFs []
36+
37+ testWithDummyPluginEmpty :: String -> Session () -> TestTree
38+ testWithDummyPluginEmpty caseName = testWithDummyPlugin caseName $ mkIdeTestFs []
39+
40+ testWithDummyPluginEmpty' :: String -> (FileSystem -> Session () ) -> TestTree
41+ testWithDummyPluginEmpty' caseName = testWithDummyPlugin' caseName $ mkIdeTestFs []
42+
3443pattern R :: UInt -> UInt -> UInt -> UInt -> Range
3544pattern R x y x' y' = Range (Position x y) (Position x' y')
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import Test.Tasty
2020
2121tests :: TestTree
2222tests = testGroup " addDependentFile"
23- [testGroup " file-changed" [testWithDummyPlugin ' " test" (mkIdeTestFs [] ) test]
23+ [testGroup " file-changed" [testWithDummyPluginEmpty ' " test" test]
2424 ]
2525 where
2626 test :: FileSystem -> Session ()
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ import qualified Language.LSP.Protocol.Lens as L
1111import Language.LSP.Protocol.Message
1212import Language.LSP.Test
1313
14- import Config (dummyPlugin , mkIdeTestFs ,
15- runWithDummyPlugin )
14+ import Config
1615import Control.Lens ((^.) )
1716import Development.IDE.Plugin.Test (blockCommandId )
1817import Test.Hls
@@ -88,7 +87,7 @@ tests = withResource acquire release tests where
8887 innerCaps (TResponseMessage _ _ (Left _)) = error " Initialization error"
8988
9089 acquire :: IO (TResponseMessage Method_Initialize )
91- acquire = runWithDummyPlugin (mkIdeTestFs [] ) initializeResponse
90+ acquire = runWithDummyPluginEmpty initializeResponse
9291
9392 release :: TResponseMessage Method_Initialize -> IO ()
9493 release = mempty
You can’t perform that action at this time.
0 commit comments