summaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.py
diff options
context:
space:
mode:
authorMarkus Jörg <markus-joerg@hotmail.de>2025-11-14 07:47:28 +0100
committerDylan Baker <dylan@pnwbakers.com>2025-11-19 09:15:03 -0800
commitf314f68f9f05f31b686b42575c373d4a42ec2d5e (patch)
treeca1c9de04131673a033095544f8782e82d684421 /unittests/allplatformstests.py
parenta01cedecc4fed77f468ee15d272f06c918f119e5 (diff)
downloadmeson-f314f68f9f05f31b686b42575c373d4a42ec2d5e.tar.gz
tests: Fix regex in test_slice
If the first line already conained a match, the former regex didn't catch it correctly, because it was looking for a newline character to detect the start of a line. The new regex is using the proper `^` to match the beginning of a line. For this to work as expected the `re.MULTILINE` flag has to be set.
Diffstat (limited to 'unittests/allplatformstests.py')
-rw-r--r--unittests/allplatformstests.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 2dc3eacf0..d1e5a554d 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -5451,7 +5451,9 @@ class AllPlatformTests(BasePlatformTests):
'10/10': [10],
}.items():
output = self._run(self.mtest_command + ['--slice=' + arg])
- tests = sorted([ int(x) for x in re.findall(r'\n[ 0-9]+/[0-9]+ test_slice:test-([0-9]*)', output) ])
+ tests = sorted([
+ int(x) for x in re.findall(r'^[ 0-9]+/[0-9]+ test_slice:test-([0-9]*)', output, flags=re.MULTILINE)
+ ])
self.assertEqual(tests, expectation)
for arg, expectation in {'': 'error: argument --slice: value does not conform to format \'SLICE/NUM_SLICES\'',