From bb826b9f93d97ae44ec6e32d92b4e9a0f33b14c8 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 1 Apr 2025 10:24:19 +0200 Subject: [PATCH] Add more phpunit to aclude lang file with a simple % character. --- test/phpunit/LangTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index 2442b165848..424ad1ac341 100644 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -249,6 +249,11 @@ class LangTest extends CommonClassTest //print $prefix."Result for checking we don't have bad percent char = ".$result.PHP_EOL; $this->assertTrue($result === false, 'Found a bad percent char % instead of % in file '.$code.'/'.$file); + $reg = array(); + $result = preg_match('/(.*)([^%])%$/m', $filecontent, $reg); // A sequence of char we don't want + //print $prefix."Result for checking we don't have bad percent char = ".$result.PHP_EOL; + $this->assertTrue($result == 0, 'Found the character % alone in the translation file '.$code.'/'.$file.' on line '.(empty($reg[1]) ? '' : $reg[1]).(empty($reg[2]) ? '' : $reg[2]).'. We probably want %s or %%'); + $result = preg_match('/%n/m', $filecontent); // A sequence of char we don't want //print $prefix."Result for checking we don't have bad percent char = ".$result.PHP_EOL; $this->assertTrue($result == 0, 'Found a sequence %n in the translation file '.$code.'/'.$file.'. We probably want %s');