summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lint_tests/test_lint_dctrl.py38
-rw-r--r--tests/lint_tests/test_lint_debputy.py23
-rw-r--r--tests/lsp_tests/test_lsp_debputy_manifest_completer.py49
3 files changed, 110 insertions, 0 deletions
diff --git a/tests/lint_tests/test_lint_dctrl.py b/tests/lint_tests/test_lint_dctrl.py
index c91d43d..7478461 100644
--- a/tests/lint_tests/test_lint_dctrl.py
+++ b/tests/lint_tests/test_lint_dctrl.py
@@ -497,6 +497,44 @@ def test_dctrl_lint_sv_udeb_only(line_linter: LintWrapper) -> None:
assert not diagnostics
+def test_dctrl_lint_udeb_menu_iten(line_linter: LintWrapper) -> None:
+ lines = textwrap.dedent(
+ """\
+ Source: foo
+ Section: devel
+ Priority: optional
+ Maintainer: Jane Developer <jane@example.com>
+ Build-Depends: debhelper-compat (= 13)
+
+ Package: foo-udeb
+ Architecture: all
+ Package-Type: udeb
+ Section: debian-installer
+ XB-Installer-Menu-Item: 12345
+ Description: Some very interesting synopsis
+ A very interesting description
+ that spans multiple lines
+ .
+ Just so be clear, this is for a test.
+
+ Package: bar-udeb
+ Architecture: all
+ Package-Type: udeb
+ Section: debian-installer
+ XB-Installer-Menu-Item: ${foo}
+ Description: Some very interesting synopsis
+ A very interesting description
+ that spans multiple lines
+ .
+ Just so be clear, this is for a test.
+ """
+ ).splitlines(keepends=True)
+
+ diagnostics = line_linter(lines)
+ print(diagnostics)
+ assert not diagnostics
+
+
def test_dctrl_lint_multiple_vcs(line_linter: LintWrapper) -> None:
lines = textwrap.dedent(
f"""\
diff --git a/tests/lint_tests/test_lint_debputy.py b/tests/lint_tests/test_lint_debputy.py
index 8e405f8..28dab00 100644
--- a/tests/lint_tests/test_lint_debputy.py
+++ b/tests/lint_tests/test_lint_debputy.py
@@ -85,6 +85,29 @@ def test_debputy_lint_unknown_keys(line_linter: LintWrapper) -> None:
assert f"{fourth_error.range}" == "16:4-16:8"
+def test_debputy_lint_null_keys(line_linter: LintWrapper) -> None:
+ lines = textwrap.dedent(
+ """\
+ manifest-version: '0.1'
+ installations:
+ - install-docs:
+ :
+ - GETTING-STARTED-WITH-dh-debputy.md
+ - MANIFEST-FORMAT.md
+ - MIGRATING-A-DH-PLUGIN.md
+ """
+ ).splitlines(keepends=True)
+
+ diagnostics = line_linter(lines)
+ assert len(diagnostics) == 1
+ issue = diagnostics[0]
+
+ msg = "Missing key"
+ assert issue.message == msg
+ assert f"{issue.range}" == "3:4-3:5"
+ assert issue.severity == DiagnosticSeverity.Error
+
+
@requires_levenshtein
def test_debputy_lint_unknown_keys_spelling(line_linter: LintWrapper) -> None:
lines = textwrap.dedent(
diff --git a/tests/lsp_tests/test_lsp_debputy_manifest_completer.py b/tests/lsp_tests/test_lsp_debputy_manifest_completer.py
index 196df2e..dab26d3 100644
--- a/tests/lsp_tests/test_lsp_debputy_manifest_completer.py
+++ b/tests/lsp_tests/test_lsp_debputy_manifest_completer.py
@@ -597,3 +597,52 @@ def test_basic_debputy_completer_manifest_conditions(
assert "not:" in keywords
# str-only forms are not applicable here
assert "cross-compiling" not in keywords
+
+
+def test_basic_debputy_completer_mid_doc(ls: "DebputyLanguageServer") -> None:
+ debputy_manifest_uri = "file:///nowhere/debian/debputy.manifest"
+ cursor_pos = put_doc_with_cursor(
+ ls,
+ debputy_manifest_uri,
+ "debian/debputy.manifest",
+ textwrap.dedent(
+ """\
+ manifest-version: 0.1
+ installations:
+ - install-docs:
+ s<CURSOR>
+ - foo
+"""
+ ),
+ )
+
+ completions = debputy_manifest_completer(
+ ls,
+ CompletionParams(TextDocumentIdentifier(debputy_manifest_uri), cursor_pos),
+ )
+ assert isinstance(completions, list)
+ keywords = {m.label for m in completions}
+ assert "sources:" in keywords
+
+ cursor_pos = put_doc_with_cursor(
+ ls,
+ debputy_manifest_uri,
+ "debian/debputy.manifest",
+ textwrap.dedent(
+ """\
+ manifest-version: 0.1
+ installations:
+ - install-docs:
+ s<CURSOR>:
+ - foo
+"""
+ ),
+ )
+
+ completions = debputy_manifest_completer(
+ ls,
+ CompletionParams(TextDocumentIdentifier(debputy_manifest_uri), cursor_pos),
+ )
+ assert isinstance(completions, list)
+ keywords = {m.label for m in completions}
+ assert "sources" in keywords