mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Show a better expected vs actual for tests with large output
Summary: When tests have a lot of output, show a diff of the expected/actual. Test Plan: Used this when developing D2016 to examine large output usefully. Reviewers: btrahan Reviewed By: btrahan CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D2017
This commit is contained in:
parent
b67ce7e534
commit
9db7f294ef
2 changed files with 10 additions and 9 deletions
|
@ -79,17 +79,17 @@ abstract class ArcanistPhutilTestCase {
|
|||
|
||||
$output .= "\n";
|
||||
|
||||
if (strpos($expect, "\n") !== false) {
|
||||
$expect = "\n{$expect}";
|
||||
if (strpos($expect, "\n") === false && strpos($result, "\n") === false) {
|
||||
$output .= "Expected: {$expect}\n";
|
||||
$output .= "Actual: {$result}";
|
||||
} else {
|
||||
$output .= "Expected vs Actual Output Diff\n";
|
||||
$output .= ArcanistDiffUtils::renderDifferences(
|
||||
$expect,
|
||||
$result,
|
||||
$lines = 0xFFFF);
|
||||
}
|
||||
|
||||
if (strpos($result, "\n") !== false) {
|
||||
$result = "\n{$result}";
|
||||
}
|
||||
|
||||
$output .= "Expected: {$expect}\n";
|
||||
$output .= "Actual: {$result}";
|
||||
|
||||
$this->failTest($output);
|
||||
throw new ArcanistPhutilTestTerminatedException($output);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('arcanist', 'difference');
|
||||
phutil_require_module('arcanist', 'unit/engine/phutil/testcase/exception');
|
||||
phutil_require_module('arcanist', 'unit/result');
|
||||
|
||||
|
|
Loading…
Reference in a new issue