From e9c80de73cf0257a6f4675e090c3ad2e4991a078 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 12 Aug 2014 19:32:15 -0700 Subject: [PATCH] Make arcanist lint tests flexible about testcase formatting 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 | 2 +- src/lint/linter/__tests__/text/variable-dividers.lint-test | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/lint/linter/__tests__/text/variable-dividers.lint-test diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php index ae2e3e9f..e60bd0d9 100644 --- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php +++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php @@ -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 index 00000000..9e9110aa --- /dev/null +++ b/src/lint/linter/__tests__/text/variable-dividers.lint-test @@ -0,0 +1,3 @@ +This is just testing that we're flexible about the number of "~" characters on +the line separating the data sections. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.43.0