mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 08:12:40 +01:00
phutil_utf8_shorten => PhutilUTF8StringTruncator
Summary: Ref T3307. Very easy Test Plan: this very diff! Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T3307 Differential Revision: https://secure.phabricator.com/D10391
This commit is contained in:
parent
f17b1fa1c4
commit
c8f15136c8
3 changed files with 12 additions and 3 deletions
|
@ -24,7 +24,9 @@ final class ArcanistXUnitTestResultParser {
|
|||
$load_success = @$xunit_dom->loadXML($test_results);
|
||||
|
||||
if (!$load_success) {
|
||||
$input_start = phutil_utf8_shorten($test_results, 150);
|
||||
$input_start = id(new PhutilUTF8StringTruncator())
|
||||
->setMaximumGlyphs(150)
|
||||
->truncateString($test_results);
|
||||
throw new Exception(
|
||||
"Failed to load XUnit report; Input starts with:\n\n {$input_start}");
|
||||
}
|
||||
|
|
|
@ -1509,7 +1509,9 @@ EOTEXT
|
|||
$preview = explode("\n", $saved);
|
||||
$preview = array_shift($preview);
|
||||
$preview = trim($preview);
|
||||
$preview = phutil_utf8_shorten($preview, 64);
|
||||
$preview = id(new PhutilUTF8StringTruncator())
|
||||
->setMaximumGlyphs(64)
|
||||
->truncateString($preview);
|
||||
|
||||
if ($preview) {
|
||||
$preview = "Message begins:\n\n {$preview}\n\n";
|
||||
|
|
|
@ -88,7 +88,12 @@ EOTEXT
|
|||
// Make sure notes that are long or have line breaks in them or
|
||||
// whatever don't mess up the formatting.
|
||||
$note = implode(' ', preg_split('/\s+/', $note));
|
||||
$note = ' ('.phutil_utf8_shorten($note, 40, '...').')';
|
||||
$note = ' ('.
|
||||
id(new PhutilUTF8StringTruncator())
|
||||
->setMaximumGlyphs(40)
|
||||
->setTerminator('...')
|
||||
->truncateString($note).
|
||||
')';
|
||||
}
|
||||
echo phutil_console_format(
|
||||
"<fg:{$color}>%s</fg> flag%s $verb!\n",
|
||||
|
|
Loading…
Reference in a new issue