Page MenuHomePhabricator

D11341.id27247.diff
No OneTemporary

D11341.id27247.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,17 @@
implode("\n", $raised));
foreach (array_diff_key($expect, $seen) as $missing => $ignored) {
- list($sev, $line, $char) = explode(':', $missing);
+ list($sev, $pos) = explode(':', $missing);
+ $pos = (array) $pos;
+
$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
Sat, Oct 19, 5:37 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6733212
Default Alt Text
D11341.id27247.diff (3 KB)

Event Timeline