1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 10:12:41 +01:00

Minor "arc unit" coverage display updates

Summary:
  - Show coverage for all files, not just files that have some coverage
information.
  - Read file data off disk, under git the "current" data is the data at HEAD,
not the (possibly unstaged/uncommitted) file in the working copy which we
actually ran.

Test Plan: Ran "arc unit --detailed-coverage" on various files.

Reviewers: tuomaspelkonen, btrahan

Reviewed By: tuomaspelkonen

CC: aran, epriestley

Maniphest Tasks: T818

Differential Revision: https://secure.phabricator.com/D1542
This commit is contained in:
epriestley 2012-02-01 17:36:25 -08:00
parent bea4cd83d7
commit 85083db929
2 changed files with 10 additions and 5 deletions

View file

@ -193,7 +193,9 @@ EOTEXT
}
if ($coverage) {
$file_coverage = array();
$file_coverage = array_fill_keys(
$paths,
0);
$file_reports = array();
foreach ($coverage as $file => $reports) {
$report = ArcanistUnitTestResult::mergeCoverage($reports);
@ -218,9 +220,12 @@ EOTEXT
sprintf('% 3d', (int)(100 * $coverage)),
$file);
if ($this->getArgument('detailed-coverage')) {
$full_path = $working_copy->getProjectRoot().'/'.$file;
if ($this->getArgument('detailed-coverage') &&
Filesystem::pathExists($full_path) &&
is_file($full_path)) {
echo $this->renderDetailedCoverageReport(
$file,
Filesystem::readFile($full_path),
$file_reports[$file]);
}
}
@ -298,8 +303,7 @@ EOTEXT
return ' <1ms';
}
private function renderDetailedCoverageReport($file, $report) {
$data = $this->getRepositoryAPI()->getCurrentFileData($file);
private function renderDetailedCoverageReport($data, $report) {
$data = explode("\n", $data);
$out = '';

View file

@ -12,6 +12,7 @@ phutil_require_module('arcanist', 'unit/result');
phutil_require_module('arcanist', 'workflow/base');
phutil_require_module('phutil', 'console');
phutil_require_module('phutil', 'filesystem');
phutil_require_module('phutil', 'symbols');
phutil_require_module('phutil', 'utils');