forked from ppy/osu-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ppy#11923 from notbakaneko/feature/fix-zalgo-test
Use correct dataprovider in ZalgoTest
- Loading branch information
Showing
1 changed file
with
24 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
} | ||
|
@@ -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], | ||
]; | ||
} | ||
} |