Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13979259
D11341.id27267.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11341.id27267.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11341: Add unit tests for `ArcanistFilenameLinter`
Attached
Detach File
Event Timeline
Log In to Comment