Fix coordinates in TestDartLanguageServer.test_request_defining_symbol_variable

This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-03-28 01:14:05 +01:00
1 parent 971941d5c6
commit 28bf726f53
1 file changed
+7 -2
+7 -2
View File
@@ -3,6 +3,7 @@ from pathlib import Path
import pytest
from serena.util.text_utils import find_text_coordinates
from solidlsp import SolidLanguageServer
from solidlsp.ls_config import Language
from solidlsp.ls_types import SymbolKind
@@ -243,8 +244,12 @@ class TestDartLanguageServer:
def test_request_defining_symbol_variable(self, language_server: SolidLanguageServer) -> None:
"""Test request_defining_symbol for a variable usage."""
file_path = os.path.join("lib", "main.dart")
# Line 14 contains 'final result = a + b;' - test position on 'result'
defining_symbol = language_server.request_defining_symbol(file_path, 13, 10)
# Find coordinates of 'final result = a + b;' - test position on 'result'
with language_server.open_file(file_path, open_in_ls=False) as f:
pos = find_text_coordinates(f.contents, r"final (result) = a \+ b;")
defining_symbol = language_server.request_defining_symbol(file_path, pos.line, pos.col)
# The defining symbol might be the variable itself or the containing method
# This is acceptable behavior - different language servers handle this differently