summaryrefslogtreecommitdiffstats
path: root/test/rules/test_line_too_long.py
blob: 3c7517b2320202ca531d69ec54e6ed8ab6cb4c9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Tests for line-too-long rule."""
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.yaml_rule import YamllintRule
from ansiblelint.testing import RunFromText

LONG_LINE = """\
---
- name: Task example
  debug:
    msg: 'This is a very long text that is used in order to verify the rule that checks for very long lines. We do hope it was long enough to go over the line limit.'
"""  # noqa: E501


def test_long_line() -> None:
    """Negative test for long-line."""
    collection = RulesCollection()
    collection.register(YamllintRule())
    runner = RunFromText(collection)
    results = runner.run_role_tasks_main(LONG_LINE)
    assert len(results) == 1