summaryrefslogtreecommitdiffstats
path: root/tests/lint_tests/test_lint_dcpy.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 16:40:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 16:40:52 +0000
commitede5a1f9cb549d56ff1f3b2a3f5437d13bd14444 (patch)
tree4cdbdc6bb5e78080f2c0a6e049b2146afeebd362 /tests/lint_tests/test_lint_dcpy.py
parentAdding upstream version 0.1.36. (diff)
downloaddebputy-ede5a1f9cb549d56ff1f3b2a3f5437d13bd14444.tar.xz
debputy-ede5a1f9cb549d56ff1f3b2a3f5437d13bd14444.zip
Adding upstream version 0.1.37.upstream/0.1.37
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/lint_tests/test_lint_dcpy.py')
-rw-r--r--tests/lint_tests/test_lint_dcpy.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lint_tests/test_lint_dcpy.py b/tests/lint_tests/test_lint_dcpy.py
index 9b89b67..ac16022 100644
--- a/tests/lint_tests/test_lint_dcpy.py
+++ b/tests/lint_tests/test_lint_dcpy.py
@@ -5,6 +5,7 @@ import pytest
from debputy.lsp.lsp_debian_copyright import _lint_debian_copyright
from debputy.packages import DctrlParser
from debputy.plugin.api.feature_set import PluginProvidedFeatureSet
+from debputy.plugin.api.test_api import build_virtual_file_system
from lint_tests.lint_tutil import (
group_diagnostics_by_severity,
LintWrapper,
@@ -59,3 +60,28 @@ def test_dcpy_files_lint(line_linter: LintWrapper) -> None:
msg = 'Simplify to a single "/"'
assert second_warn.message == msg
assert f"{second_warn.range}" == "2:25-2:28"
+
+
+def test_dcpy_files_matches_dir_lint(line_linter: LintWrapper) -> None:
+ lines = textwrap.dedent(
+ """\
+ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+ Files: foo
+ Copyright: Noone <noone@example.com>
+ License: something
+ yada yada yada
+ """
+ ).splitlines(keepends=True)
+
+ source_root = build_virtual_file_system(["./foo/bar"])
+ line_linter.source_root = source_root
+
+ diagnostics = line_linter(lines)
+ assert len(diagnostics) == 1
+ issue = diagnostics[0]
+
+ msg = "Directories cannot be a match. Use `dir/*` to match everything in it"
+ assert issue.message == msg
+ assert f"{issue.range}" == "2:7-2:10"
+ assert issue.severity == DiagnosticSeverity.Warning