Page MenuHomePhabricator

D11341.id27267.diff
No OneTemporary

D11341.id27267.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
@@ -74,6 +74,7 @@
'ArcanistExternalLinterTestCase' => 'lint/linter/__tests__/ArcanistExternalLinterTestCase.php',
'ArcanistFeatureWorkflow' => 'workflow/ArcanistFeatureWorkflow.php',
'ArcanistFilenameLinter' => 'lint/linter/ArcanistFilenameLinter.php',
+ 'ArcanistFilenameLinterTestCase' => 'lint/linter/__tests__/ArcanistFilenameLinterTestCase.php',
'ArcanistFlagWorkflow' => 'workflow/ArcanistFlagWorkflow.php',
'ArcanistFlake8Linter' => 'lint/linter/ArcanistFlake8Linter.php',
'ArcanistFlake8LinterTestCase' => 'lint/linter/__tests__/ArcanistFlake8LinterTestCase.php',
@@ -269,6 +270,7 @@
'ArcanistExternalLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistFeatureWorkflow' => 'ArcanistWorkflow',
'ArcanistFilenameLinter' => 'ArcanistLinter',
+ 'ArcanistFilenameLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistFlagWorkflow' => 'ArcanistWorkflow',
'ArcanistFlake8Linter' => 'ArcanistExternalLinter',
'ArcanistFlake8LinterTestCase' => 'ArcanistExternalLinterTestCase',
diff --git a/src/lint/engine/ArcanistUnitTestableLintEngine.php b/src/lint/engine/ArcanistUnitTestableLintEngine.php
--- a/src/lint/engine/ArcanistUnitTestableLintEngine.php
+++ b/src/lint/engine/ArcanistUnitTestableLintEngine.php
@@ -19,7 +19,7 @@
}
public function pathExists($path) {
- if (idx($this->fileData, $path)) {
+ if (idx($this->fileData, $path) !== null) {
return true;
}
return parent::pathExists($path);
diff --git a/src/lint/linter/__tests__/ArcanistFilenameLinterTestCase.php b/src/lint/linter/__tests__/ArcanistFilenameLinterTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/ArcanistFilenameLinterTestCase.php
@@ -0,0 +1,10 @@
+<?php
+
+final class ArcanistFilenameLinterTestCase
+ extends ArcanistArcanistLinterTestCase {
+
+ public function testLinter() {
+ $this->executeTestsInDirectory(dirname(__FILE__).'/filename/');
+ }
+
+}
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
@@ -207,15 +207,18 @@
implode("\n", $raised));
foreach (array_diff_key($expect, $seen) as $missing => $ignored) {
- list($sev, $line, $char) = explode(':', $missing);
+ $missing = explode(':', $missing);
+ $sev = array_shift($missing);
+ $pos = $missing;
+
$this->assertFailure(
pht(
"In '%s', expected lint to raise %s on line %d at char %d, ".
"but no %s was raised. %s",
$file,
$sev,
- $line,
- $char,
+ idx($pos, 0),
+ idx($pos, 1),
$sev,
$raised));
}
diff --git a/src/lint/linter/__tests__/filename/bad_filename.lint-test b/src/lint/linter/__tests__/filename/bad_filename.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/filename/bad_filename.lint-test
@@ -0,0 +1,5 @@
+~~~~~~~~~~
+error::
+~~~~~~~~~~
+~~~~~~~~~~
+{"path": "bad@filename"}
diff --git a/src/lint/linter/__tests__/filename/good_filename.lint-test b/src/lint/linter/__tests__/filename/good_filename.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/filename/good_filename.lint-test
@@ -0,0 +1,4 @@
+~~~~~~~~~~
+~~~~~~~~~~
+~~~~~~~~~~
+{"path": "good_filename"}

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 20, 3:35 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6713249
Default Alt Text
D11341.id27267.diff (3 KB)

Event Timeline