summaryrefslogtreecommitdiffstats
path: root/tests/lsp_tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 16:23:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 16:23:19 +0000
commit3554c1d4ae60c53c0232d05454ff853dc537096b (patch)
tree9f528439859090d3800a85fc43d13b8bf53bf451 /tests/lsp_tests
parentAdding debian version 0.1.32. (diff)
downloaddebputy-3554c1d4ae60c53c0232d05454ff853dc537096b.tar.xz
debputy-3554c1d4ae60c53c0232d05454ff853dc537096b.zip
Merging upstream version 0.1.33.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/lsp_tests')
-rw-r--r--tests/lsp_tests/test_lsp_dpatches_series.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/lsp_tests/test_lsp_dpatches_series.py b/tests/lsp_tests/test_lsp_dpatches_series.py
new file mode 100644
index 0000000..e7a1275
--- /dev/null
+++ b/tests/lsp_tests/test_lsp_dpatches_series.py
@@ -0,0 +1,59 @@
+import textwrap
+
+from debputy.lsp.debputy_ls import DebputyLanguageServer
+
+try:
+ from lsprotocol.types import (
+ CompletionParams,
+ TextDocumentIdentifier,
+ HoverParams,
+ MarkupContent,
+ SemanticTokensParams,
+ )
+
+ from debputy.lsp.lsp_debian_patches_series import (
+ _debian_patches_semantic_tokens_full,
+ _debian_patches_series_completions,
+ )
+
+ from pygls.server import LanguageServer
+except ImportError:
+ pass
+from lsp_tests.lsp_tutil import (
+ put_doc_no_cursor,
+ resolve_semantic_tokens,
+ resolved_semantic_token,
+)
+
+
+def test_dpatches_series_semantic_tokens(ls: "DebputyLanguageServer") -> None:
+ doc_uri = "file:///nowhere/debian/patches/series"
+ put_doc_no_cursor(
+ ls,
+ doc_uri,
+ "debian/patches/series",
+ textwrap.dedent(
+ """\
+ # Some leading comment
+
+ some.patch
+
+ another-delta.diff # foo
+"""
+ ),
+ )
+
+ semantic_tokens = _debian_patches_semantic_tokens_full(
+ ls,
+ SemanticTokensParams(TextDocumentIdentifier(doc_uri)),
+ )
+ resolved_semantic_tokens = resolve_semantic_tokens(semantic_tokens)
+ assert resolved_semantic_tokens is not None
+ assert resolved_semantic_tokens == [
+ resolved_semantic_token(0, 0, len("# Some leading comment"), "comment"),
+ resolved_semantic_token(2, 0, len("some.patch"), "string"),
+ resolved_semantic_token(4, 0, len("another-delta.diff"), "string"),
+ resolved_semantic_token(
+ 4, len("another-delta.diff") + 1, len("# foo"), "comment"
+ ),
+ ]