Page MenuHomePhabricator

D11345.diff
No OneTemporary

D11345.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -81,6 +81,7 @@
'ArcanistFlake8LinterTestCase' => 'lint/linter/__tests__/ArcanistFlake8LinterTestCase.php',
'ArcanistFutureLinter' => 'lint/linter/ArcanistFutureLinter.php',
'ArcanistGeneratedLinter' => 'lint/linter/ArcanistGeneratedLinter.php',
+ 'ArcanistGeneratedLinterTestCase' => 'lint/linter/__tests__/ArcanistGeneratedLinterTestCase.php',
'ArcanistGetConfigWorkflow' => 'workflow/ArcanistGetConfigWorkflow.php',
'ArcanistGitAPI' => 'repository/api/ArcanistGitAPI.php',
'ArcanistGitHookPreReceiveWorkflow' => 'workflow/ArcanistGitHookPreReceiveWorkflow.php',
@@ -131,7 +132,7 @@
'ArcanistNoEffectException' => 'exception/usage/ArcanistNoEffectException.php',
'ArcanistNoEngineException' => 'exception/usage/ArcanistNoEngineException.php',
'ArcanistNoLintLinter' => 'lint/linter/ArcanistNoLintLinter.php',
- 'ArcanistNoLintTestCaseMisnamed' => 'lint/linter/__tests__/ArcanistNoLintTestCase.php',
+ 'ArcanistNoLintLinterTestCase' => 'lint/linter/__tests__/ArcanistNoLintLinterTestCase.php',
'ArcanistNoneLintRenderer' => 'lint/renderer/ArcanistNoneLintRenderer.php',
'ArcanistPEP8Linter' => 'lint/linter/ArcanistPEP8Linter.php',
'ArcanistPEP8LinterTestCase' => 'lint/linter/__tests__/ArcanistPEP8LinterTestCase.php',
@@ -278,6 +279,7 @@
'ArcanistFlake8LinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistFutureLinter' => 'ArcanistLinter',
'ArcanistGeneratedLinter' => 'ArcanistLinter',
+ 'ArcanistGeneratedLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistGetConfigWorkflow' => 'ArcanistWorkflow',
'ArcanistGitAPI' => 'ArcanistRepositoryAPI',
'ArcanistGitHookPreReceiveWorkflow' => 'ArcanistWorkflow',
@@ -317,7 +319,7 @@
'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException',
'ArcanistNoLintLinter' => 'ArcanistLinter',
- 'ArcanistNoLintTestCaseMisnamed' => 'ArcanistPhutilTestCase',
+ 'ArcanistNoLintLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistNoneLintRenderer' => 'ArcanistLintRenderer',
'ArcanistPEP8Linter' => 'ArcanistExternalLinter',
'ArcanistPEP8LinterTestCase' => 'ArcanistExternalLinterTestCase',
diff --git a/src/lint/linter/__tests__/ArcanistGeneratedLinterTestCase.php b/src/lint/linter/__tests__/ArcanistGeneratedLinterTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/ArcanistGeneratedLinterTestCase.php
@@ -0,0 +1,10 @@
+<?php
+
+final class ArcanistGeneratedLinterTestCase
+ extends ArcanistArcanistLinterTestCase {
+
+ public function testLinter() {
+ return $this->executeTestsInDirectory(dirname(__FILE__).'/generated/');
+ }
+
+}
diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
--- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php
+++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
@@ -87,6 +87,7 @@
'config' => 'optional map<string, wild>',
'path' => 'optional string',
'mode' => 'optional string',
+ 'stopped' => 'optional bool',
));
$exception = null;
@@ -126,8 +127,8 @@
$path_name = idx($config, 'path', $path);
$linter->addPath($path_name);
$linter->addData($path_name, $data);
- $config = idx($config, 'config', array());
- foreach ($config as $key => $value) {
+
+ foreach (idx($config, 'config', array()) as $key => $value) {
$linter->setLinterConfigurationValue($key, $value);
}
@@ -141,6 +142,16 @@
count($results),
pht('Expect one result returned by linter.'));
+ $assert_stopped = idx($config, 'stopped');
+ if ($assert_stopped !== null) {
+ $this->assertEqual(
+ $assert_stopped,
+ $linter->didStopAllLinters(),
+ $assert_stopped
+ ? pht('Expect linter to be stopped.')
+ : pht('Expect linter to not be stopped.'));
+ }
+
$result = reset($results);
$patcher = ArcanistLintPatcher::newFromArcanistLintResult($result);
$after_lint = $patcher->getModifiedFileContent();
diff --git a/src/lint/linter/__tests__/ArcanistNoLintLinterTestCase.php b/src/lint/linter/__tests__/ArcanistNoLintLinterTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/ArcanistNoLintLinterTestCase.php
@@ -0,0 +1,10 @@
+<?php
+
+final class ArcanistNoLintLinterTestCase
+ extends ArcanistArcanistLinterTestCase {
+
+ public function testLinter() {
+ return $this->executeTestsInDirectory(dirname(__FILE__).'/nolint/');
+ }
+
+}
diff --git a/src/lint/linter/__tests__/ArcanistNoLintTestCase.php b/src/lint/linter/__tests__/ArcanistNoLintTestCase.php
deleted file mode 100644
--- a/src/lint/linter/__tests__/ArcanistNoLintTestCase.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-/**
- * Not a real test... meant to fail lint if @nolint is not respected.
- */
-final class ArcanistNoLintTestCaseMisnamed extends ArcanistPhutilTestCase {}
diff --git a/src/lint/linter/__tests__/generated/generated.lint-test b/src/lint/linter/__tests__/generated/generated.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/generated/generated.lint-test
@@ -0,0 +1,7 @@
+@generated
+~~~~~~~~~~
+~~~~~~~~~~
+~~~~~~~~~~
+{
+ "stopped": true
+}
diff --git a/src/lint/linter/__tests__/generated/not-generated.lint-test b/src/lint/linter/__tests__/generated/not-generated.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/generated/not-generated.lint-test
@@ -0,0 +1,7 @@
+@not-generated
+~~~~~~~~~~
+~~~~~~~~~~
+~~~~~~~~~~
+{
+ "stopped": false
+}
diff --git a/src/lint/linter/__tests__/nolint/lint.lint-test b/src/lint/linter/__tests__/nolint/lint.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/nolint/lint.lint-test
@@ -0,0 +1,7 @@
+@lint
+~~~~~~~~~~
+~~~~~~~~~~
+~~~~~~~~~~
+{
+ "stopped": false
+}
diff --git a/src/lint/linter/__tests__/nolint/nolint.lint-test b/src/lint/linter/__tests__/nolint/nolint.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/nolint/nolint.lint-test
@@ -0,0 +1,7 @@
+@nolint
+~~~~~~~~~~
+~~~~~~~~~~
+~~~~~~~~~~
+{
+ "stopped": true
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 5, 6:53 PM (15 h, 7 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7733518
Default Alt Text
D11345.diff (6 KB)

Event Timeline