Skip to content

Commit 534bfb8

Browse files
committed
Make generated test strings a warning, print them
1 parent cf1ce64 commit 534bfb8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/GenerateTestStrings.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
exit( 1 );
1313
}
1414

15+
$ExitWithError = false;
16+
1517
foreach( $Rulesets as $Type => $Rules )
1618
{
1719
foreach( $Rules as $Name => $RuleRegexes )
@@ -62,7 +64,9 @@
6264

6365
if( getenv( 'CI' ) !== false )
6466
{
65-
echo "::notice file={$File}::Updated {$Type}.{$Name} (please run GenerateTestStrings and commit it)\n";
67+
$ExitWithError = true;
68+
$NewContents = implode( '%0A', $Tests );
69+
echo "::warning file={$File}::Updated {$Type}.{$Name} (please run GenerateTestStrings and commit it)%0ANew file contents:%0A{$NewContents}";
6670
}
6771
else
6872
{
@@ -74,6 +78,11 @@
7478
echo "Now running tests...\n";
7579
require __DIR__ . '/Test.php';
7680

81+
if( $ExitWithError )
82+
{
83+
exit( 1 );
84+
}
85+
7786
/**
7887
* Native PHP regex pattern generator
7988
* Generates ALL possible variations from regex patterns with smart bounds for infinite cases

0 commit comments

Comments
 (0)