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

Display line number with assertion for failed test cases

Summary: We use custom `assert*` functions here and there. Remove them from backtrace.

Test Plan: Ran `XHPASTTreeTestCase`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D6411
This commit is contained in:
Jakub Vrana 2013-07-10 08:42:49 -07:00
parent f5ceceea87
commit ad9cb418c4

View file

@ -52,8 +52,12 @@ abstract class ArcanistPhutilTestCase {
$expect = PhutilReadableSerializer::printableValue($expect);
$result = PhutilReadableSerializer::printableValue($result);
$where = debug_backtrace();
$where = array_shift($where);
foreach (debug_backtrace() as $location) {
if (!preg_match('/^assert[A-Z]/', idx($location, 'function'))) {
break;
}
$where = $location;
}
$line = idx($where, 'line');
$file = basename(idx($where, 'file'));