diff --git a/src/unit/ArcanistUnitTestResult.php b/src/unit/ArcanistUnitTestResult.php index 74805581..f570c072 100644 --- a/src/unit/ArcanistUnitTestResult.php +++ b/src/unit/ArcanistUnitTestResult.php @@ -57,11 +57,30 @@ final class ArcanistUnitTestResult extends Phobject { return $this->result; } + + /** + * Set the number of seconds spent executing this test. + * + * Reporting this information can help users identify slow tests and reduce + * the total cost of running a test suite. + * + * Callers should pass an integer or a float. For example, pass `3` for + * 3 seconds, or `0.125` for 125 milliseconds. + * + * @param int|float Duration, in seconds. + * @return this + */ public function setDuration($duration) { + if (!is_int($duration) && !is_float($duration)) { + throw new Exception( + pht( + 'Parameter passed to setDuration() must be an integer or a float.')); + } $this->duration = $duration; return $this; } + public function getDuration() { return $this->duration; } diff --git a/src/unit/parser/ArcanistGoTestResultParser.php b/src/unit/parser/ArcanistGoTestResultParser.php index fa0a2672..ce6451f5 100644 --- a/src/unit/parser/ArcanistGoTestResultParser.php +++ b/src/unit/parser/ArcanistGoTestResultParser.php @@ -31,7 +31,7 @@ final class ArcanistGoTestResultParser extends ArcanistTestResultParser { // We have a passing test $meta = array(); preg_match( - '/^--- PASS: (?P.+) \((?P