Changeset View
Changeset View
Standalone View
Standalone View
src/utils/__tests__/PhutilUTF8TestCase.php
Context not available. | |||||
public function testUTF8izeLongStringNosegfault() { | public function testUTF8izeLongStringNosegfault() { | ||||
// For some reason my laptop is segfaulting on long inputs inside | // For some reason my laptop is segfaulting on long inputs inside | ||||
// preg_match(). Forestall this craziness in the common case, at least. | // @preg_match(). Forestall this craziness in the common case, at least. | ||||
phutil_utf8ize(str_repeat('x', 1024 * 1024)); | phutil_utf8ize(str_repeat('x', 1024 * 1024)); | ||||
$this->assertTrue(true); | $this->assertTrue(true); | ||||
} | } | ||||
Context not available. | |||||
'quack' => 5, | 'quack' => 5, | ||||
); | ); | ||||
foreach ($strings as $str => $expect) { | foreach ($strings as $str => $expect) { | ||||
$this->assertEqual($expect, phutil_utf8_strlen($str), 'Length of '.$str); | $this->assertEqual($expect, phutil_utf8strlen($str), 'Length of '.$str); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
foreach ($strings as $str => $expect) { | foreach ($strings as $str => $expect) { | ||||
$this->assertEqual( | $this->assertEqual( | ||||
$expect, | $expect, | ||||
phutil_utf8_console_strlen($str), | phutil_utf8_consolestrlen($str), | ||||
pht('Console Length of %s', $str)); | pht('Console Length of %s', $str)); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
} | } | ||||
} | } | ||||
public function testUTF8strtolower() { | public function testUTF8@strtolower() { | ||||
$tests = array( | $tests = array( | ||||
'' => '', | '' => '', | ||||
'a' => 'a', | 'a' => 'a', | ||||
Context not available. | |||||
public function testSystemLocaleManagement() { | public function testSystemLocaleManagement() { | ||||
$original_locale = phutil_get_system_locale(); | $original_locale = phutil_get_system_locale(); | ||||
$this->assertTrue( | $this->assertTrue( | ||||
(strlen($original_locale) > 0), | (@strlen($original_locale) > 0), | ||||
pht('System has some identifiable locale.')); | pht('System has some identifiable locale.')); | ||||
$this->assertFalse( | $this->assertFalse( | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0