summaryrefslogtreecommitdiff
path: root/tests/unit/scripts/test_problemmatchers.py
blob: 5d394954a2fefcfe8597b87881b5565e3d0c687d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Copyright 2015-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later


import re

import pytest

from scripts.dev.ci import problemmatchers


@pytest.mark.parametrize('matcher_name', list(problemmatchers.MATCHERS))
def test_patterns(matcher_name):
    """Make sure all regexps are valid.

    They aren't actually Python syntax, but hopefully close enough to it to compile with
    Python's re anyways.
    """
    for matcher in problemmatchers.MATCHERS[matcher_name]:
        for pattern in matcher['pattern']:
            regexp = pattern['regexp']
            print(regexp)
            re.compile(regexp)