Merge pull request #724 from fabio-ivona/fix-test-names-collision

[chore] Fix underscores in test names
This commit is contained in:
Nuno Maduro
2023-03-22 11:16:24 +00:00
committed by GitHub
3 changed files with 5 additions and 1 deletions

View File

@ -59,6 +59,8 @@ final class Str
*/
public static function evaluable(string $code): string
{
$code = str_replace('_', '__', $code);
$code = self::PREFIX.str_replace(' ', '_', $code);
// sticks to PHP8.2 function naming rules https://www.php.net/manual/en/functions.user-defined.php

View File

@ -8,6 +8,6 @@ it('evaluates the code', function ($evaluatable, $expected) {
expect($code)->toBe($expected);
})->with([
['version()', '__pest_evaluable_version__'],
['version__ ', '__pest_evaluable_version___'],
['version__ ', '__pest_evaluable_version_____'],
['version\\', '__pest_evaluable_version_'],
]);

View File

@ -13,6 +13,8 @@ it('may start with P', function (string $real, string $toBePrinted) {
]);
$names = [
'test description' => '__pest_evaluable_test_description',
'test_description' => '__pest_evaluable_test__description',
'ふ+が+' => '__pest_evaluable_ふ_が_',
'ほげ' => '__pest_evaluable_ほげ',
'卜竹弓一十山' => '__pest_evaluable_卜竹弓一十山',