summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-09-08 14:22:32 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-09-08 14:22:32 +0200
commit16189974ddede13e5b3080a252bfbe6e6296e30f (patch)
tree124b1f34ffe0db881b26c95c5b9ed57291625330 /scripts
parent3e149427561dc04650aacfa61f9eb431da397997 (diff)
parentababa221369568addd8af3c96097a78dda80db9b (diff)
downloadphp-git-16189974ddede13e5b3080a252bfbe6e6296e30f.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Support more placeholders in bless_tests.php
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dev/bless_tests.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/dev/bless_tests.php b/scripts/dev/bless_tests.php
index 49160d0cc9..674bbeda8e 100755
--- a/scripts/dev/bless_tests.php
+++ b/scripts/dev/bless_tests.php
@@ -77,8 +77,15 @@ function normalizeOutput(string $out): string {
function formatToRegex(string $format): string {
$result = preg_quote($format, '/');
- $result = str_replace('%d', '\d+', $result);
+ $result = str_replace('%e', '\\' . DIRECTORY_SEPARATOR, $result);
$result = str_replace('%s', '[^\r\n]+', $result);
+ $result = str_replace('%S', '[^\r\n]*', $result);
+ $result = str_replace('%w', '\s*', $result);
+ $result = str_replace('%i', '[+-]?\d+', $result);
+ $result = str_replace('%d', '\d+', $result);
+ $result = str_replace('%x', '[0-9a-fA-F]+', $result);
+ $result = str_replace('%f', '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', $result);
+ $result = str_replace('%c', '.', $result);
return "/^$result$/s";
}
@@ -105,10 +112,10 @@ function generateMinimallyDifferingOutput(string $out, string $oldExpect) {
}
function insertOutput(string $phpt, string $out): string {
- return preg_replace_callback('/--EXPECTF?--.*$/s', function($matches) use($out) {
+ return preg_replace_callback('/--EXPECTF?--.*?(--CLEAN--|$)/sD', function($matches) use($out) {
$hasWildcard = preg_match('/%[resSaAwidxfc]/', $out);
$F = $hasWildcard ? 'F' : '';
- return "--EXPECT$F--\n" . $out . "\n";
+ return "--EXPECT$F--\n" . $out . "\n" . $matches[1];
}, $phpt);
}