mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 02:37:22 +01:00
Merge pull request #724 from fabio-ivona/fix-test-names-collision
[chore] Fix underscores in test names
This commit is contained in:
@ -59,6 +59,8 @@ final class Str
|
|||||||
*/
|
*/
|
||||||
public static function evaluable(string $code): string
|
public static function evaluable(string $code): string
|
||||||
{
|
{
|
||||||
|
$code = str_replace('_', '__', $code);
|
||||||
|
|
||||||
$code = self::PREFIX.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
|
// sticks to PHP8.2 function naming rules https://www.php.net/manual/en/functions.user-defined.php
|
||||||
|
|||||||
@ -8,6 +8,6 @@ it('evaluates the code', function ($evaluatable, $expected) {
|
|||||||
expect($code)->toBe($expected);
|
expect($code)->toBe($expected);
|
||||||
})->with([
|
})->with([
|
||||||
['version()', '__pest_evaluable_version__'],
|
['version()', '__pest_evaluable_version__'],
|
||||||
['version__ ', '__pest_evaluable_version___'],
|
['version__ ', '__pest_evaluable_version_____'],
|
||||||
['version\\', '__pest_evaluable_version_'],
|
['version\\', '__pest_evaluable_version_'],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -13,6 +13,8 @@ it('may start with P', function (string $real, string $toBePrinted) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$names = [
|
$names = [
|
||||||
|
'test description' => '__pest_evaluable_test_description',
|
||||||
|
'test_description' => '__pest_evaluable_test__description',
|
||||||
'ふ+が+' => '__pest_evaluable_ふ_が_',
|
'ふ+が+' => '__pest_evaluable_ふ_が_',
|
||||||
'ほげ' => '__pest_evaluable_ほげ',
|
'ほげ' => '__pest_evaluable_ほげ',
|
||||||
'卜竹弓一十山' => '__pest_evaluable_卜竹弓一十山',
|
'卜竹弓一十山' => '__pest_evaluable_卜竹弓一十山',
|
||||||
|
|||||||
Reference in New Issue
Block a user