================
@@ -2,47 +2,91 @@
 Test lldb-dap completions request
 """
 
+# FIXME: remove when LLDB_MINIMUM_PYTHON_VERSION > 3.8
+from __future__ import annotations
+
+import json
+from typing import Optional
 import lldbdap_testcase
-import dap_server
-from lldbsuite.test import lldbutil
+from dataclasses import dataclass, replace, asdict
 from lldbsuite.test.decorators import skipIf
 from lldbsuite.test.lldbtest import line_number
 
-session_completion = {
-    "text": "session",
-    "label": "session",
-    "detail": "Commands controlling LLDB session.",
-}
-settings_completion = {
-    "text": "settings",
-    "label": "settings",
-    "detail": "Commands for managing LLDB settings.",
-}
-memory_completion = {
-    "text": "memory",
-    "label": "memory",
-    "detail": "Commands for operating on memory in the current target 
process.",
-}
-command_var_completion = {
-    "text": "var",
-    "label": "var",
-    "detail": "Show variables for the current stack frame. Defaults to all 
arguments and local variables in scope. Names of argument, local, file static 
and file global variables can be specified.",
-}
-variable_var_completion = {"text": "var", "label": "var", "detail": 
"vector<baz> &"}
-variable_var1_completion = {"text": "var1", "label": "var1", "detail": "int &"}
-variable_var2_completion = {"text": "var2", "label": "var2", "detail": "int &"}
+
+@dataclass(frozen=True)
+class CompletionItem:
+    label: str
+    text: Optional[str] = None
+    detail: Optional[str] = None
+    start: Optional[int] = None
+    length: int = 0
+
+    def __repr__(self):
+        # use json as it easier to see the diff on failure.
+        return json.dumps(asdict(self), indent=4)
+
+    def clone(self, **kwargs) -> CompletionItem:
+        """Creates a copy of this CompletionItem with specified fields 
modified."""
+        return replace(self, **kwargs)
+
+
+@dataclass(frozen=True)
+class TestCase:
----------------
ashgti wrote:

nit: Could we rename this, its a little confusing since our unit test is 
separate from this test case.

Maybe `CompletionExpectation` or `InputExpectation`?

https://github.com/llvm/llvm-project/pull/177151
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to