|
1 | 1 | """test that callHierarchy/incomingCalls works for dispatching calls""" |
2 | 2 |
|
3 | | -import os |
4 | | - |
5 | | -from drivers.lsp_ada_requests import ( |
6 | | - didOpen_from_disk, |
7 | | - incomingCalls, |
8 | | - prepareCallHierarchy, |
| 3 | +from drivers.pylsp import ( |
| 4 | + URI, |
| 5 | + ALSLanguageClient, |
| 6 | + assertLocationsList, |
| 7 | + callHierarchyIncomingCallsParams, |
| 8 | + callHierarchyPrepareParams, |
| 9 | + didOpenTextDocumentParams, |
| 10 | + test, |
9 | 11 | ) |
10 | | -from drivers.lsp_python_driver import simple_test |
11 | 12 |
|
12 | 13 |
|
13 | | -@simple_test |
14 | | -def test_called_by(lsp, wd): |
| 14 | +@test() |
| 15 | +async def test_called_by(lsp: ALSLanguageClient): |
15 | 16 | # Send a didOpen for main.adb |
16 | | - main_adb = os.path.join(wd, "main.adb") |
17 | | - root_ads = os.path.join(wd, "root.ads") |
18 | | - p_adb = os.path.join(wd, "p.adb") |
19 | | - |
20 | | - lsp.send(didOpen_from_disk(main_adb)) |
| 17 | + open_params, main_adb_uri = didOpenTextDocumentParams("main.adb") |
| 18 | + root_ads_uri = URI("root.ads") |
| 19 | + lsp.text_document_did_open(open_params) |
21 | 20 |
|
22 | 21 | # Send a textDocument/prepareCallHierarchy request |
23 | | - response = lsp.send(prepareCallHierarchy(main_adb, 7, 4)) |
| 22 | + result1 = await lsp.text_document_prepare_call_hierarchy_async( |
| 23 | + callHierarchyPrepareParams(main_adb_uri, 7, 4) |
| 24 | + ) |
| 25 | + assert result1 |
24 | 26 |
|
25 | 27 | # Expect these locations |
26 | | - response.assertLocationsList([("root.ads", 5)]) |
| 28 | + assertLocationsList(result1, [("root.ads", 5)]) |
27 | 29 |
|
28 | 30 | # Now send the callHierarchy/incomingCalls request |
29 | | - response = lsp.send(incomingCalls(root_ads, 5, 14)) |
| 31 | + result2 = await lsp.call_hierarchy_incoming_calls_async( |
| 32 | + callHierarchyIncomingCallsParams(root_ads_uri, 5, 14) |
| 33 | + ) |
| 34 | + assert result2 |
30 | 35 |
|
31 | 36 | # Expect these locations |
32 | | - response.assertLocationsList([("main.adb", 3)]) |
| 37 | + assertLocationsList(result2, [("main.adb", 3)]) |
0 commit comments