mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 08:42:40 +01:00
Publicize formatting unit test result
Summary: I want to use it from outside. Test Plan: $ arc unit src/lint/linter/__tests__/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3493
This commit is contained in:
parent
fefa9e2d72
commit
ac7b9e42d6
2 changed files with 16 additions and 17 deletions
|
@ -66,6 +66,18 @@ final class ArcanistUnitTestResult {
|
||||||
return $this->result;
|
return $this->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getConsoleFormattedResult() {
|
||||||
|
static $status_codes = array(
|
||||||
|
self::RESULT_PASS => '<bg:green>** PASS **</bg>',
|
||||||
|
self::RESULT_FAIL => '<bg:red>** FAIL **</bg>',
|
||||||
|
self::RESULT_SKIP => '<bg:yellow>** SKIP **</bg>',
|
||||||
|
self::RESULT_BROKEN => '<bg:red>** BROKEN **</bg>',
|
||||||
|
self::RESULT_UNSOUND => '<bg:yellow>** UNSOUND **</bg>',
|
||||||
|
self::RESULT_POSTPONED => '<bg:yellow>** POSTPONED **</bg>',
|
||||||
|
);
|
||||||
|
return phutil_console_format($status_codes[$this->result]);
|
||||||
|
}
|
||||||
|
|
||||||
public function setDuration($duration) {
|
public function setDuration($duration) {
|
||||||
$this->duration = $duration;
|
$this->duration = $duration;
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -147,21 +147,6 @@ EOTEXT
|
||||||
$results = $this->engine->run();
|
$results = $this->engine->run();
|
||||||
$this->testResults = $results;
|
$this->testResults = $results;
|
||||||
|
|
||||||
$status_codes = array(
|
|
||||||
ArcanistUnitTestResult::RESULT_PASS => phutil_console_format(
|
|
||||||
'<bg:green>** PASS **</bg>'),
|
|
||||||
ArcanistUnitTestResult::RESULT_FAIL => phutil_console_format(
|
|
||||||
'<bg:red>** FAIL **</bg>'),
|
|
||||||
ArcanistUnitTestResult::RESULT_SKIP => phutil_console_format(
|
|
||||||
'<bg:yellow>** SKIP **</bg>'),
|
|
||||||
ArcanistUnitTestResult::RESULT_BROKEN => phutil_console_format(
|
|
||||||
'<bg:red>** BROKEN **</bg>'),
|
|
||||||
ArcanistUnitTestResult::RESULT_UNSOUND => phutil_console_format(
|
|
||||||
'<bg:yellow>** UNSOUND **</bg>'),
|
|
||||||
ArcanistUnitTestResult::RESULT_POSTPONED => phutil_console_format(
|
|
||||||
'<bg:yellow>** POSTPONED **</bg>'),
|
|
||||||
);
|
|
||||||
|
|
||||||
$console = PhutilConsole::getConsole();
|
$console = PhutilConsole::getConsole();
|
||||||
|
|
||||||
$unresolved = array();
|
$unresolved = array();
|
||||||
|
@ -180,7 +165,7 @@ EOTEXT
|
||||||
}
|
}
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
" %s %s\n",
|
" %s %s\n",
|
||||||
$status_codes[$result_code].$duration,
|
$result->getConsoleFormattedResult().$duration,
|
||||||
$result->getName());
|
$result->getName());
|
||||||
}
|
}
|
||||||
if ($result_code != ArcanistUnitTestResult::RESULT_PASS) {
|
if ($result_code != ArcanistUnitTestResult::RESULT_PASS) {
|
||||||
|
@ -197,9 +182,11 @@ EOTEXT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($postponed_count) {
|
if ($postponed_count) {
|
||||||
|
$postponed = id(new ArcanistUnitTestResult())
|
||||||
|
->setResult(ArcanistUnitTestResult::RESULT_POSTPONED);
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"%s %s\n",
|
"%s %s\n",
|
||||||
$status_codes[ArcanistUnitTestResult::RESULT_POSTPONED],
|
$postponed->getConsoleFormattedResult(),
|
||||||
pht('%d test(s)', $postponed_count));
|
pht('%d test(s)', $postponed_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue