From: Jakub Vrana Date: Wed, 10 Jul 2013 15:42:49 +0000 (-0700) Subject: Display line number with assertion for failed test cases X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=ad9cb418c41a9b777a20ce04c4b90c63d94d9113;p=arcanist.git 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 --- diff --git a/src/unit/engine/phutil/ArcanistPhutilTestCase.php b/src/unit/engine/phutil/ArcanistPhutilTestCase.php index 9b4f2bda..d88e5e93 100644 --- a/src/unit/engine/phutil/ArcanistPhutilTestCase.php +++ b/src/unit/engine/phutil/ArcanistPhutilTestCase.php @@ -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'));