From 0f7e9722c34db36a03d8cd91e118b4fa31351ed9 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Mon, 2 Feb 2026 14:40:26 +0000 Subject: [PATCH] Update C# tests to use exact matching for normalized symbol names Replace startswith() checks with exact matching now that symbol names are normalized at the source. This is cleaner and more accurate. Comments updated to reflect that names are normalized (not type-annotated). All 14 tests pass. --- test/solidlsp/csharp/test_csharp_basic.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/solidlsp/csharp/test_csharp_basic.py b/test/solidlsp/csharp/test_csharp_basic.py index df4930a1..173673ca 100644 --- a/test/solidlsp/csharp/test_csharp_basic.py +++ b/test/solidlsp/csharp/test_csharp_basic.py @@ -56,8 +56,8 @@ class TestCSharpLanguageServer: # Handle nested symbol structure symbol_list = symbols[0] if symbols and isinstance(symbols[0], list) else symbols for sym in symbol_list: - # New Roslyn format includes type annotations (e.g., "Add(int, int) : int") - if sym.get("name", "").startswith("Add"): + # Symbol names are normalized to base form (e.g., "Add" not "Add(int, int) : int") + if sym.get("name") == "Add": add_symbol = sym break assert add_symbol is not None, "Could not find 'Add' method symbol in Program.cs" @@ -83,13 +83,13 @@ class TestCSharpLanguageServer: # Check that we have the Person class assert any(s.get("name") == "Person" and s.get("kind") == 5 for s in symbols) - # Check for properties and methods (new Roslyn format includes type annotations) + # Check for properties and methods (names are normalized to base form) symbol_names = [s.get("name") for s in symbols] - assert any(name.startswith("Name") for name in symbol_names), "Name property not found" - assert any(name.startswith("Age") for name in symbol_names), "Age property not found" - assert any(name.startswith("Email") for name in symbol_names), "Email property not found" - assert any(name.startswith("ToString") for name in symbol_names), "ToString method not found" - assert any(name.startswith("IsAdult") for name in symbol_names), "IsAdult method not found" + assert "Name" in symbol_names, "Name property not found" + assert "Age" in symbol_names, "Age property not found" + assert "Email" in symbol_names, "Email property not found" + assert "ToString" in symbol_names, "ToString method not found" + assert "IsAdult" in symbol_names, "IsAdult method not found" @pytest.mark.parametrize("language_server", [Language.CSHARP], indirect=True) def test_find_referencing_symbols_across_files(self, language_server: SolidLanguageServer) -> None: @@ -103,8 +103,8 @@ class TestCSharpLanguageServer: subtract_symbol = None for sym in symbol_list: - # New Roslyn format includes type annotations (e.g., "Subtract(int, int) : int") - if sym.get("name", "").startswith("Subtract"): + # Symbol names are normalized to base form (e.g., "Subtract" not "Subtract(int, int) : int") + if sym.get("name") == "Subtract": subtract_symbol = sym break