mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Minor cleanup of linter testing code.
Summary: Just some minor cleaning up, including: - Removing old annotations for Diviner. - Renaming some `lint-test` files so that the directory name bears a closer resemblance to that of the linter. - Remove some useless `return` statements. Test Plan: `arc unit`. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9096
This commit is contained in:
parent
c4c0fbd7cd
commit
d826bf65c6
14 changed files with 17 additions and 61 deletions
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
abstract class ArcanistArcanistLinterTestCase extends ArcanistLinterTestCase {
|
abstract class ArcanistArcanistLinterTestCase extends ArcanistLinterTestCase {
|
||||||
|
|
||||||
protected function getLink($method) {
|
protected function getLink($method) {
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Test cases for @{class:ArcanistCpplintLinter}.
|
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
final class ArcanistCpplintLinterTestCase
|
final class ArcanistCpplintLinterTestCase
|
||||||
extends ArcanistArcanistLinterTestCase {
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testCpplintLint() {
|
public function testCpplintLint() {
|
||||||
return $this->executeTestsInDirectory(
|
return $this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/cpp/',
|
dirname(__FILE__).'/cpplint/',
|
||||||
new ArcanistCpplintLinter());
|
new ArcanistCpplintLinter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Test cases for @{class:ArcanistFlake8Linter}.
|
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
final class ArcanistFlake8LinterTestCase
|
final class ArcanistFlake8LinterTestCase
|
||||||
extends ArcanistArcanistLinterTestCase {
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testFlake8Lint() {
|
public function testFlake8Lint() {
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/flake8/',
|
dirname(__FILE__).'/flake8/',
|
||||||
new ArcanistFlake8Linter());
|
new ArcanistFlake8Linter());
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Facilitates implementation of test cases for @{class:ArcanistLinter}s.
|
* Facilitates implementation of test cases for @{class:ArcanistLinter}s.
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
*/
|
||||||
abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
||||||
|
|
||||||
|
@ -154,7 +152,7 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
||||||
$char = $message->getChar();
|
$char = $message->getChar();
|
||||||
$code = $message->getCode();
|
$code = $message->getCode();
|
||||||
$name = $message->getName();
|
$name = $message->getName();
|
||||||
$message_key = $sev.":".$line.":".$char;
|
$message_key = $sev.':'.$line.':'.$char;
|
||||||
$message_map[$message_key] = $message;
|
$message_map[$message_key] = $message;
|
||||||
$seen[] = $message_key;
|
$seen[] = $message_key;
|
||||||
$raised[] = " {$sev} at line {$line}, char {$char}: {$code} {$name}";
|
$raised[] = " {$sev} at line {$line}, char {$char}: {$code} {$name}";
|
||||||
|
@ -173,7 +171,7 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
||||||
$seen = array_fill_keys($seen, true);
|
$seen = array_fill_keys($seen, true);
|
||||||
|
|
||||||
if (!$raised) {
|
if (!$raised) {
|
||||||
$raised = array("No messages.");
|
$raised = array('No messages.');
|
||||||
}
|
}
|
||||||
$raised = "Actually raised:\n".implode("\n", $raised);
|
$raised = "Actually raised:\n".implode("\n", $raised);
|
||||||
|
|
||||||
|
@ -186,7 +184,6 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array_diff_key($seen, $expect) as $surprising => $ignored) {
|
foreach (array_diff_key($seen, $expect) as $surprising => $ignored) {
|
||||||
|
|
||||||
$message = $message_map[$surprising];
|
$message = $message_map[$surprising];
|
||||||
$message_info = $message->getDescription();
|
$message_info = $message->getDescription();
|
||||||
|
|
||||||
|
@ -205,6 +202,6 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
||||||
$this->assertEqual(
|
$this->assertEqual(
|
||||||
$expected,
|
$expected,
|
||||||
$actual,
|
$actual,
|
||||||
"File as patched by lint did not match the expected patched file.");
|
'File as patched by lint did not match the expected patched file.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for @{class:ArcanistNoLintLinter}.
|
* Not a real test... meant to fail lint if @nolint is not respected.
|
||||||
*
|
|
||||||
* Not a real test... meant to fail lint
|
|
||||||
* if @nolint is not respected.
|
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
*/
|
||||||
final class ArcanistNoLintTestCaseMisnamed extends ArcanistLinterTestCase {
|
final class ArcanistNoLintTestCaseMisnamed extends ArcanistLinterTestCase {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
final class ArcanistPHPCSLinterTestCase extends ArcanistArcanistLinterTestCase {
|
final class ArcanistPHPCSLinterTestCase extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testPHPCSLint() {
|
public function testPHPCSLint() {
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/phpcs/',
|
dirname(__FILE__).'/phpcs/',
|
||||||
new ArcanistPhpcsLinter());
|
new ArcanistPhpcsLinter());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
final class ArcanistPhutilXHPASTLinterTestCase
|
final class ArcanistPhutilXHPASTLinterTestCase
|
||||||
extends ArcanistArcanistLinterTestCase {
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
|
@ -12,7 +9,7 @@ final class ArcanistPhutilXHPASTLinterTestCase
|
||||||
'deprecated_function' => 'This function is most likely deprecated.',
|
'deprecated_function' => 'This function is most likely deprecated.',
|
||||||
));
|
));
|
||||||
|
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/phlxhp/',
|
dirname(__FILE__).'/phlxhp/',
|
||||||
$linter);
|
$linter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ final class ArcanistPuppetLintLinterTestCase
|
||||||
extends ArcanistArcanistLinterTestCase {
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testPuppetLintLinter() {
|
public function testPuppetLintLinter() {
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/puppet-lint/',
|
dirname(__FILE__).'/puppet-lint/',
|
||||||
new ArcanistPuppetLintLinter());
|
new ArcanistPuppetLintLinter());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ final class ArcanistPyFlakesLinterTestCase
|
||||||
extends ArcanistArcanistLinterTestCase {
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testPyflakesLinter() {
|
public function testPyflakesLinter() {
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/pyflakes/',
|
dirname(__FILE__).'/pyflakes/',
|
||||||
new ArcanistPyFlakesLinter());
|
new ArcanistPyFlakesLinter());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Test cases for @{class:ArcanistRubyLinter}.
|
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
final class ArcanistRubyLinterTestCase extends ArcanistArcanistLinterTestCase {
|
final class ArcanistRubyLinterTestCase extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testRubyLint() {
|
public function testRubyLint() {
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/ruby/',
|
dirname(__FILE__).'/ruby/',
|
||||||
new ArcanistRubyLinter());
|
new ArcanistRubyLinter());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Test cases for @{class:ArcanistSpellingLinter}.
|
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
final class ArcanistSpellingLinterTestCase
|
final class ArcanistSpellingLinterTestCase
|
||||||
extends ArcanistArcanistLinterTestCase {
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
|
@ -13,7 +8,7 @@ final class ArcanistSpellingLinterTestCase
|
||||||
$linter->addPartialWordRule('supermn', 'superman');
|
$linter->addPartialWordRule('supermn', 'superman');
|
||||||
$linter->addWholeWordRule('batmn', 'batman');
|
$linter->addWholeWordRule('batmn', 'batman');
|
||||||
|
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/spelling/',
|
dirname(__FILE__).'/spelling/',
|
||||||
$linter);
|
$linter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Test cases for @{class:ArcanistTextLinter}.
|
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
final class ArcanistTextLinterTestCase extends ArcanistArcanistLinterTestCase {
|
final class ArcanistTextLinterTestCase extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testTextLint() {
|
public function testTextLint() {
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/text/',
|
dirname(__FILE__).'/text/',
|
||||||
new ArcanistTextLinter());
|
new ArcanistTextLinter());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for @{class:ArcanistXHPASTLinter}.
|
|
||||||
*
|
|
||||||
* @group testcase
|
|
||||||
*/
|
|
||||||
final class ArcanistXHPASTLinterTestCase
|
final class ArcanistXHPASTLinterTestCase
|
||||||
extends ArcanistArcanistLinterTestCase {
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
|
@ -17,7 +12,7 @@ final class ArcanistXHPASTLinterTestCase
|
||||||
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
||||||
));
|
));
|
||||||
|
|
||||||
return $this->executeTestsInDirectory(
|
$this->executeTestsInDirectory(
|
||||||
dirname(__FILE__).'/xhpast/',
|
dirname(__FILE__).'/xhpast/',
|
||||||
$linter);
|
$linter);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue