summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-12-03 18:47:27 +0100
committerFlorian Bruhin <me@the-compiler.org>2020-12-03 18:47:27 +0100
commit53e706b1708684bb19be98be0fc7147f02b42dc2 (patch)
treefc2080a5f4be2a885ea47db1bc89526d26770343
parentc1ab6837ae4d8a96bc9ff7cb3ecc615502f00924 (diff)
downloadqutebrowser-53e706b1708684bb19be98be0fc7147f02b42dc2.tar.gz
qutebrowser-53e706b1708684bb19be98be0fc7147f02b42dc2.zip
Add a test for problem matchers
-rw-r--r--tests/unit/scripts/test_problemmatchers.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/scripts/test_problemmatchers.py b/tests/unit/scripts/test_problemmatchers.py
new file mode 100644
index 000000000..98bd9c7a5
--- /dev/null
+++ b/tests/unit/scripts/test_problemmatchers.py
@@ -0,0 +1,38 @@
+# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
+
+# Copyright 2015-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
+
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
+
+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)