summaryrefslogtreecommitdiffstats
path: root/tests/lint_tests/test_lint_dctrl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lint_tests/test_lint_dctrl.py')
-rw-r--r--tests/lint_tests/test_lint_dctrl.py58
1 files changed, 47 insertions, 11 deletions
diff --git a/tests/lint_tests/test_lint_dctrl.py b/tests/lint_tests/test_lint_dctrl.py
index ce34d7c..bcb1613 100644
--- a/tests/lint_tests/test_lint_dctrl.py
+++ b/tests/lint_tests/test_lint_dctrl.py
@@ -18,6 +18,9 @@ except ImportError:
pass
+STANDARDS_VERSION = "4.7.0"
+
+
class DctrlLintWrapper(LintWrapper):
def __call__(self, lines: List[str]) -> Optional[List["Diagnostic"]]:
@@ -93,15 +96,15 @@ def test_dctrl_lint(line_linter: LintWrapper) -> None:
msg = 'The value "base" is not supported in Section.'
assert second_warn.message == msg
- assert f"{second_warn.range}" == "8:9-8:13"
+ assert f"{second_warn.range}" == "7:9-7:13"
@requires_levenshtein
def test_dctrl_lint_typos(line_linter: LintWrapper) -> None:
lines = textwrap.dedent(
- """\
+ f"""\
Source: foo
- Standards-Version: 4.5.2
+ Standards-Version: {STANDARDS_VERSION}
Priority: optional
Section: devel
Maintainer: Jane Developer <jane@example.com>
@@ -132,9 +135,9 @@ def test_dctrl_lint_typos(line_linter: LintWrapper) -> None:
@requires_levenshtein
def test_dctrl_lint_mx_value_with_typo(line_linter: LintWrapper) -> None:
lines = textwrap.dedent(
- """\
+ f"""\
Source: foo
- Standards-Version: 4.5.2
+ Standards-Version: {STANDARDS_VERSION}
Priority: optional
Section: devel
Maintainer: Jane Developer <jane@example.com>
@@ -165,15 +168,15 @@ def test_dctrl_lint_mx_value_with_typo(line_linter: LintWrapper) -> None:
typo_msg = 'It is possible that the value is a typo of "all".'
assert mx_diag.message == mx_msg
assert typo_diag.message == typo_msg
- assert f"{mx_diag.range}" == "10:24-10:28"
- assert f"{typo_diag.range}" == "10:24-10:28"
+ assert f"{mx_diag.range}" == "9:24-9:28"
+ assert f"{typo_diag.range}" == "9:24-9:28"
def test_dctrl_lint_mx_value(line_linter: LintWrapper) -> None:
lines = textwrap.dedent(
- """\
+ f"""\
Source: foo
- Standards-Version: 4.5.2
+ Standards-Version: {STANDARDS_VERSION}
Priority: optional
Section: devel
Maintainer: Jane Developer <jane@example.com>
@@ -200,9 +203,9 @@ def test_dctrl_lint_mx_value(line_linter: LintWrapper) -> None:
assert f"{diag.range}" == "8:14-8:17"
lines = textwrap.dedent(
- """\
+ f"""\
Source: foo
- Standards-Version: 4.5.2
+ Standards-Version: {STANDARDS_VERSION}
Priority: optional
Section: devel
Maintainer: Jane Developer <jane@example.com>
@@ -227,3 +230,36 @@ def test_dctrl_lint_mx_value(line_linter: LintWrapper) -> None:
assert diag.message == msg
assert diag.severity == DiagnosticSeverity.Error
assert f"{diag.range}" == "8:24-8:27"
+
+
+def test_dctrl_lint_dup_sep(line_linter: LintWrapper) -> None:
+ lines = textwrap.dedent(
+ f"""\
+ Source: foo
+ Section: devel
+ Priority: optional
+ Standards-Version: {STANDARDS_VERSION}
+ Maintainer: Jane Developer <jane@example.com>
+ Build-Depends: debhelper-compat (= 13)
+
+ Package: foo
+ Architecture: all
+ Depends: foo,
+ , bar
+ 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 diagnostics and len(diagnostics) == 1
+ error = diagnostics[0]
+
+ msg = "Duplicate separator"
+ assert error.message == msg
+ assert f"{error.range}" == "10:1-10:2"
+ assert error.severity == DiagnosticSeverity.Error