1010from multilspy .multilspy_types import Position , CompletionItemKind
1111from tests .test_utils import create_test_context
1212from pathlib import PurePath
13+ from tests .multilspy .test_sync_multilspy_ruby import EXPECTED_RESULT
1314
1415
15- async def test_multilspy_ruby_carbonyl ():
16+ @pytest .mark .asyncio
17+ async def test_multilspy_ruby_rubyland ():
1618 """
17- Test the working of multilspy with ruby repository - rails/rails
19+ Test the working of multilspy with ruby repository - rubyland
1820 """
1921 code_language = Language .RUBY
2022 params = {
2123 "code_language" : code_language ,
22- "repo_url" : "https://github.com/rails/rails /" ,
23- "repo_commit" : "abb7035e08c07bb4e2941c1c27003609ce81e77b "
24+ "repo_url" : "https://github.com/jrochkind/rubyland /" ,
25+ "repo_commit" : "c243ee2533a5822f5699a2475e492927ace039c7 "
2426 }
2527 with create_test_context (params ) as context :
2628 lsp = LanguageServer .create (context .config , context .logger , context .source_directory )
@@ -29,21 +31,21 @@ async def test_multilspy_ruby_carbonyl():
2931 # The server process is started when the context manager is entered and is terminated when the context manager is exited.
3032 # The context manager is an asynchronous context manager, so it must be used with async with.
3133 async with lsp .start_server ():
32- result = await lsp .request_definition (str (PurePath ("activemodel/lib/active_model .rb" )), 132 , 18 )
34+ result = await lsp .request_definition (str (PurePath ("app/controllers/feed_controller .rb" )), 11 , 23 )
3335
3436 assert isinstance (result , list )
35- assert len (result ) == 1
36- item = result [0 ]
37- assert item ["relativePath" ] == str (PurePath ("actionview/lib/action_view .rb" ))
37+ assert len (result ) == 2
38+ item = result [1 ]
39+ assert item ["relativePath" ] == str (PurePath ("app/models/feed .rb" ))
3840 assert item ["range" ] == {
39- "start" : {"line" : 43 , "character" : 11 },
40- "end" : {"line" : 43 , "character" : 19 },
41+ "start" : {"line" : 0 , "character" : 0 },
42+ "end" : {"line" : 42 , "character" : 3 },
4143 }
4244
43- result = await lsp .request_references (str (PurePath ("activemodel/lib/active_model .rb" )), 43 , 15 )
45+ result = await lsp .request_references (str (PurePath ("app/models/feed .rb" )), 0 , 7 )
4446
4547 assert isinstance (result , list )
46- assert len (result ) == 2
48+ assert len (result ) == 8
4749
4850 for item in result :
4951 del item ["uri" ]
@@ -52,58 +54,5 @@ async def test_multilspy_ruby_carbonyl():
5254 case = unittest .TestCase ()
5355 case .assertCountEqual (
5456 result ,
55- [
56- {
57- "relativePath" : str (PurePath ("activemodel/lib/active_model.rb" )),
58- "range" : {
59- "start" : {"line" : 132 , "character" : 13 },
60- "end" : {"line" : 132 , "character" : 21 },
61- },
62- },
63- {
64- "relativePath" : str (PurePath ("actionview/lib/action_view.rb" )),
65- "range" : {
66- "start" : {"line" : 16 , "character" : 13 },
67- "end" : {"line" : 16 , "character" : 21 },
68- },
69- },
70- ],
57+ EXPECTED_RESULT ,
7158 )
72-
73- # @pytest.mark.asyncio
74- # async def test_multilspy_rust_completions_mediaplayer() -> None:
75- # """
76- # Test the working of multilspy with Rust repository - mediaplayer
77- # """
78- # code_language = Language.RUST
79- # params = {
80- # "code_language": code_language,
81- # "repo_url": "https://github.com/LakshyAAAgrawal/MediaPlayer_example/",
82- # "repo_commit": "ba27bb16c7ba1d88808300364af65eb69b1d84a8",
83- # }
84-
85- # with create_test_context(params) as context:
86- # lsp = LanguageServer.create(context.config, context.logger, context.source_directory)
87- # filepath = "src/playlist.rs"
88- # # All the communication with the language server must be performed inside the context manager
89- # # The server process is started when the context manager is entered and is terminated when the context manager is exited.
90- # async with lsp.start_server():
91- # with lsp.open_file(filepath):
92- # deleted_text = lsp.delete_text_between_positions(
93- # filepath, Position(line=10, character=40), Position(line=12, character=4)
94- # )
95- # assert (
96- # deleted_text
97- # == """reset();
98- # media_player1 = media_player;
99- # """
100- # )
101-
102- # response = await lsp.request_completions(filepath, 10, 40, allow_incomplete=True)
103-
104- # response = [item for item in response if item['kind'] != CompletionItemKind.Snippet]
105-
106- # for item in response:
107- # item['completionText'] = item['completionText'][:item['completionText'].find('(')]
108-
109- # assert set([item['completionText'] for item in response]) == {'reset', 'into', 'try_into', 'prepare'}
0 commit comments