Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update a chpl-language-server test for additional warning #25437

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions tools/chpl-language-server/test/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,22 @@ async def test_incorrect_cross_file_diagnostics(client: LanguageClient):
async with source_files(client, A=fileA, B=fileB) as docs:
await save_file(client, docs("B"), docs("A"))
assert len(client.diagnostics[docs("A").uri]) == 0
assert len(client.diagnostics[docs("B").uri]) == 1
assert (
"an implicit module named 'B' is being introduced to contain file-scope code"
in client.diagnostics[docs("B").uri][0].message
)
assert len(client.diagnostics[docs("B").uri]) >= 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend setting this to == 2 to catch further added error messages if they occur.


# check if the expected warnings are present
foundImplicitModule = False
foundSameName = False
for d in client.diagnostics[docs("B").uri]:
if 'ImplicitFileModule' in d.message:
# Warning: [ImplicitFileModule]: an implicit module named 'B'
# is being introduced to contain file-scope code
foundImplicitModule = True
if 'ImplicitModuleSameName' in d.message:
# Warning: [ImplicitModuleSameName]: module 'B' has
# the same name as the implicit file module
foundSameName = True

assert foundImplicitModule and foundSameName


@pytest.mark.asyncio
Expand Down
Loading