From ede5a1f9cb549d56ff1f3b2a3f5437d13bd14444 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 17 Jun 2024 18:40:52 +0200 Subject: Adding upstream version 0.1.37. Signed-off-by: Daniel Baumann --- tests/lint_tests/test_lint_dcpy.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/lint_tests/test_lint_dcpy.py') 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 + 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 -- cgit v1.2.3