]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Make arcanist lint tests flexible about testcase formatting
authorepriestley <git@epriestley.com>
Wed, 13 Aug 2014 02:32:15 +0000 (19:32 -0700)
committerepriestley <git@epriestley.com>
Wed, 13 Aug 2014 02:32:15 +0000 (19:32 -0700)
Summary:
We currently require an exact number of "~" characters, but this is needless and error-prone.

Instead, allow any number larger than 3.

Test Plan:
  - Added meta test-case.
  - Ran `arc unit --everything`.

Reviewers: btrahan, thoughtpolice

Reviewed By: thoughtpolice

Subscribers: epriestley

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

src/lint/linter/__tests__/ArcanistLinterTestCase.php
src/lint/linter/__tests__/text/variable-dividers.lint-test [new file with mode: 0644]

index ae2e3e9fe1d54d77b9c904e901dc995b2f3897da..e60bd0d93a7b64eb0459546851797be7e1a27974 100644 (file)
@@ -26,7 +26,7 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
     $linter = clone $linter;
 
     $contents = Filesystem::readFile($file);
-    $contents = explode("~~~~~~~~~~\n", $contents);
+    $contents = preg_split('/^~{4,}\n/m', $contents);
     if (count($contents) < 2) {
       throw new Exception(
         "Expected '~~~~~~~~~~' separating test case and results.");
diff --git a/src/lint/linter/__tests__/text/variable-dividers.lint-test b/src/lint/linter/__tests__/text/variable-dividers.lint-test
new file mode 100644 (file)
index 0000000..9e9110a
--- /dev/null
@@ -0,0 +1,3 @@
+This is just testing that we're flexible about the number of "~" characters on
+the line separating the data sections.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~