Skip to content

Commit

Permalink
Add new test to lock down go-to-def without .cls-commands
Browse files Browse the repository at this point in the history
Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
  • Loading branch information
DanilaFe committed Oct 14, 2024
1 parent d3b417c commit 2eceecb
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tools/chpl-language-server/test/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,37 @@ async def test_go_to_definition_use_standard(client: LanguageClient):
await check_goto_decl_def_module(client, doc, pos((1, 10)), mod_Map)
await check_goto_decl_def_module(client, doc, pos((2, 8)), mod_Time)

@pytest.mark.asyncio
async def test_go_to_definition_use_across_modules(client: LanguageClient):
"""
Ensure that go-to-definition works on symbols that reference other modules
"""

fileA = """
module A {
var x = 42;
}
"""
fileB = """
module B {
use A;
var y = x;
}
"""

async def check(docs):
docA = docs("A")
docB = docs("B")

await check_goto_decl_def_module(client, docB, pos((1, 6)), docA)
await check_goto_decl_def(client, docB, pos((2, 10)), (docA, pos((1, 6))))

async with source_files(client, A=fileA, B=fileB) as docs:
await check(docs)

async with unrelated_source_files(client, A=fileA, B=fileB) as docs:
await check(docs)


@pytest.mark.asyncio
async def test_go_to_definition_standard_rename(client: LanguageClient):
Expand Down

0 comments on commit 2eceecb

Please sign in to comment.