]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fail lint tests if no tests are found in the test directory
authorepriestley <git@epriestley.com>
Fri, 7 Mar 2014 18:03:17 +0000 (10:03 -0800)
committerepriestley <git@epriestley.com>
Fri, 7 Mar 2014 18:03:17 +0000 (10:03 -0800)
Summary: Ref T4570. Testing a directory with no recognized tests currently passes, but should fail.

Test Plan:
  - Ran `arc unit`.
  - Removed tests from a test directory, ran `arc unit`, got test failure.

Reviewers: leebyron, btrahan

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T4570

Differential Revision: https://secure.phabricator.com/D8434

src/lint/linter/__tests__/ArcanistLinterTestCase.php

index 24d385ff95b70b2262a139339331e54c462fa9d7..5f9f7b3e1d587c6fd23fc78466698ab2d79ff947 100644 (file)
@@ -13,9 +13,16 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
       ->withSuffix('lint-test')
       ->find();
 
+    $test_count = 0;
     foreach ($files as $file) {
       $this->lintFile($root.$file, $linter);
+      $test_count++;
     }
+
+    $this->assertEqual(
+      true,
+      ($test_count > 0),
+      pht('Expected to find some .lint-test tests in directory %s!', $root));
   }
 
   private function lintFile($file, $linter) {