From 91d273a7dd9a113da47a96c4618bbfaae74b331d Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 4 Jan 2012 07:02:41 -0800 Subject: [PATCH] Slightly improve Arcanist unit test output messages Summary: - Show file/line so you can tell which assertion failed if there's a block with a zillion of them and they don't have messages. - Try to format stuff a little better. Test Plan: - Ran some failing unit tests. Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran, btrahan Differential Revision: https://secure.phabricator.com/D1304 --- .../testcase/ArcanistPhutilTestCase.php | 35 ++++++++++++++----- src/unit/engine/phutil/testcase/__init__.php | 3 ++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php b/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php index 2b8b8c27..a7e6e1f7 100644 --- a/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php +++ b/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php @@ -1,7 +1,7 @@ failTest($message); - throw new ArcanistPhutilTestTerminatedException($message); + if (strpos($result, "\n") !== false) { + $result = "\n{$result}"; + } + + $output .= "Expected: {$expect}\n"; + $output .= "Actual: {$result}"; + + $this->failTest($output); + throw new ArcanistPhutilTestTerminatedException($output); } diff --git a/src/unit/engine/phutil/testcase/__init__.php b/src/unit/engine/phutil/testcase/__init__.php index 7f7dbd12..6a8819e9 100644 --- a/src/unit/engine/phutil/testcase/__init__.php +++ b/src/unit/engine/phutil/testcase/__init__.php @@ -9,5 +9,8 @@ phutil_require_module('arcanist', 'unit/engine/phutil/testcase/exception'); phutil_require_module('arcanist', 'unit/result'); +phutil_require_module('phutil', 'readableserializer'); +phutil_require_module('phutil', 'utils'); + phutil_require_source('ArcanistPhutilTestCase.php');