Skip to content

Commit b1eb334

Browse files
committed
GeneratorTest: make a particular test more stable
The `testGeneratorWillShowEachStandardSeparately()` test uses a regex to verify the output, but that regex used the `s` modifier (`.` matches new lines), which made it less stable. This commit makes some adjustments to the regex to get rid of the `s` modifier, which should make the test more stable.
1 parent 8e8edb1 commit b1eb334

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/Core/Generators/GeneratorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,23 +249,23 @@ public function testGeneratorWillShowEachStandardSeparately()
249249
$regex = '`^
250250
\R* # Optional blank line at the start.
251251
(?:
252-
(?P<delimiter>-+\R) # Line with dashes.
252+
(?P<delimiter>-++\R) # Line with dashes.
253253
\|[ ]GENERATORTEST[ ]CODING[ ]STANDARD:[ ][^\|]+\|\R # Doc title line with prefix expected for first standard.
254254
(?P>delimiter) # Line with dashes.
255-
.+?\R{2} # Standard description.
255+
\R(?:[^\r\n]+\R)+\R{2} # Standard description.
256256
) # Only expect this group once.
257257
(?:
258258
(?P>delimiter) # Line with dashes.
259259
\|[ ]PSR1[ ]CODING[ ]STANDARD:[ ][^\|]+\|\R # Doc title line with prefix expected for second standard.
260260
(?P>delimiter) # Line with dashes.
261-
.+?\R+ # Standard description.
261+
\R(?:[^\r\n]+\R)+\R # Standard description.
262262
(?:
263263
-+[ ]CODE[ ]COMPARISON[ ]-+\R # Code Comparison starter line with dashes.
264-
(?:.+?(?P>delimiter)\R){2} # Arbitrary text followed by a delimiter line.
264+
(?:(?:[^\r\n]+\R)+(?P>delimiter)){2} # Arbitrary text followed by a delimiter line.
265265
)* # Code comparison is optional and can exist multiple times.
266266
\R+
267267
){3,} # This complete group should occur at least three times.
268-
`sx';
268+
`x';
269269

270270
$this->expectOutputRegex($regex);
271271

0 commit comments

Comments
 (0)