File tree 4 files changed +15
-7
lines changed
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
15
15
mkRange )
16
16
import Language.LSP.Test
17
17
-- import Test.QuickCheck.Instances ()
18
+ import Config
18
19
import Development.IDE.Plugin.Test (TestRequest (BlockSeconds ),
19
20
blockCommandId )
20
21
import Test.Tasty
21
22
import Test.Tasty.HUnit
22
- import TestUtils
23
23
24
24
-- | Test if ghcide asynchronously handles Commands and user Requests
25
25
tests :: TestTree
26
26
tests = testGroup " async"
27
27
[
28
- testSession " command" $ do
28
+ testWithDummyPluginEmpty " command" $ do
29
29
-- Execute a command that will block forever
30
30
let req = ExecuteCommandParams Nothing blockCommandId Nothing
31
31
void $ sendRequest SMethod_WorkspaceExecuteCommand req
@@ -38,7 +38,7 @@ tests = testGroup "async"
38
38
codeLenses <- getAndResolveCodeLenses doc
39
39
liftIO $ [ _title | CodeLens {_command = Just Command {_title}} <- codeLenses] @=?
40
40
[ " foo :: a -> a" ]
41
- , testSession " request" $ do
41
+ , testWithDummyPluginEmpty " request" $ do
42
42
-- Execute a custom request that will block for 1000 seconds
43
43
void $ sendRequest (SMethod_CustomMethod (Proxy @ " test" )) $ toJSON $ BlockSeconds 1000
44
44
-- 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
31
31
testWithDummyPlugin' :: String -> FS. VirtualFileTree -> (FileSystem -> Session () ) -> TestTree
32
32
testWithDummyPlugin' caseName vfs = testCase caseName . runWithDummyPlugin' vfs
33
33
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
+
34
43
pattern R :: UInt -> UInt -> UInt -> UInt -> Range
35
44
pattern 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
20
20
21
21
tests :: TestTree
22
22
tests = testGroup " addDependentFile"
23
- [testGroup " file-changed" [testWithDummyPlugin ' " test" (mkIdeTestFs [] ) test]
23
+ [testGroup " file-changed" [testWithDummyPluginEmpty ' " test" test]
24
24
]
25
25
where
26
26
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
11
11
import Language.LSP.Protocol.Message
12
12
import Language.LSP.Test
13
13
14
- import Config (dummyPlugin , mkIdeTestFs ,
15
- runWithDummyPlugin )
14
+ import Config
16
15
import Control.Lens ((^.) )
17
16
import Development.IDE.Plugin.Test (blockCommandId )
18
17
import Test.Hls
@@ -88,7 +87,7 @@ tests = withResource acquire release tests where
88
87
innerCaps (TResponseMessage _ _ (Left _)) = error " Initialization error"
89
88
90
89
acquire :: IO (TResponseMessage Method_Initialize )
91
- acquire = runWithDummyPlugin (mkIdeTestFs [] ) initializeResponse
90
+ acquire = runWithDummyPluginEmpty initializeResponse
92
91
93
92
release :: TResponseMessage Method_Initialize -> IO ()
94
93
release = mempty
You can’t perform that action at this time.
0 commit comments