Skip to content

Commit

Permalink
Merge pull request ppy#11923 from notbakaneko/feature/fix-zalgo-test
Browse files Browse the repository at this point in the history
Use correct dataprovider in ZalgoTest
  • Loading branch information
nanaya authored Feb 21, 2025
2 parents 56f7c48 + 0af7722 commit 3c9e99e
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions tests/ZalgoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,36 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

declare(strict_types=1);

namespace Tests;

use Symfony\Component\Finder\Finder;

class ZalgoTest extends TestCase
{
public static function dataProviderForCombination()
{
return [
['👩🏻‍⚕️'],
['再⃝'],
['N⃝H⃝K⃝'],
];
}

public static function dataProviderForUnzalgo()
{
return [
['testing', 0],
['t͘e̎s̐ťi͛ñg̈́', 1],
['t́͘e̎̀s̐̑ť̎i͛̋ñ̈́g̈́͡', 2],
];
}

/**
* @dataProvider zalgoExamples
* @dataProvider dataProviderForCombination
*/
public function testCombination($text)
public function testCombination(string $text)
{
$this->assertSame(unzalgo($text), $text);
}
Expand All @@ -32,30 +52,12 @@ public function testTranslations()
/**
* This does not seem like the best idea.
*
* @dataProvider zalgoExamples
* @dataProvider dataProviderForUnzalgo
*/
public function testUnzalgo($expected, $level)
public function testUnzalgo(string $expected, int $level)
{
$text = 't́̌͌̌͘e̎̀́͐̅s̐̑̈͋͡ť̎̅̌̅i͛̋̋͋̽ñ̈́̌̽̿g̈́̆͋͡͞';

$this->assertSame(unzalgo($text, $level), $expected);
}

public function combinationExamples()
{
return [
['👩🏻‍⚕️'],
['再⃝'],
['N⃝H⃝K⃝'],
];
}

public static function zalgoExamples()
{
return [
['testing', 0],
['t͘e̎s̐ťi͛ñg̈́', 1],
['t́͘e̎̀s̐̑ť̎i͛̋ñ̈́g̈́͡', 2],
];
}
}

0 comments on commit 3c9e99e

Please sign in to comment.