]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Display line number with assertion for failed test cases
authorJakub Vrana <jakub@vrana.cz>
Wed, 10 Jul 2013 15:42:49 +0000 (08:42 -0700)
committerJakub Vrana <jakub@vrana.cz>
Wed, 10 Jul 2013 15:42:49 +0000 (08:42 -0700)
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

src/unit/engine/phutil/ArcanistPhutilTestCase.php

index 9b4f2bdabe77dc1ff6352f0e969ea4282f2c80b6..d88e5e93afedaad411df014fde2afd72b6f06a5e 100644 (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'));