Changeset View
Changeset View
Standalone View
Standalone View
src/filesystem/__tests__/FileFinderTestCase.php
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | $this->assertFinder( | ||||
->withName('alsoinclude.txt') | ->withName('alsoinclude.txt') | ||||
->withSuffix('txt'), | ->withSuffix('txt'), | ||||
array( | array( | ||||
'include_dir.txt/subdir.txt/alsoinclude.txt', | 'include_dir.txt/subdir.txt/alsoinclude.txt', | ||||
)); | )); | ||||
} | } | ||||
public function testFinderWithGlobMagic() { | public function testFinderWithGlobMagic() { | ||||
if (phutil_is_windows()) { | |||||
// We can't write files with "\" since this is the path separator. | |||||
// We can't write files with "*" since Windows rejects them. | |||||
// This doesn't leave us too many interesting paths to test, so just | |||||
// skip this test case under Windows. | |||||
$this->assertSkipped( | |||||
pht( | |||||
'Windows can not write files with sufficiently absurd names.')); | |||||
} | |||||
// Fill a temporary directory with all this magic garbage so we don't have | // Fill a temporary directory with all this magic garbage so we don't have | ||||
// to check a bunch of files with backslashes in their names into version | // to check a bunch of files with backslashes in their names into version | ||||
// control. | // control. | ||||
$tmp_dir = Filesystem::createTemporaryDirectory(); | $tmp_dir = Filesystem::createTemporaryDirectory(); | ||||
$crazy_magic = array( | $crazy_magic = array( | ||||
'backslash\\.\\*', | 'backslash\\.\\*', | ||||
'star-*.*', | 'star-*.*', | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | $this->assertFinder( | ||||
)); | )); | ||||
} | } | ||||
private function assertFinder($label, FileFinder $finder, $expect) { | private function assertFinder($label, FileFinder $finder, $expect) { | ||||
$modes = array( | $modes = array( | ||||
'php', | 'php', | ||||
'shell', | 'shell', | ||||
); | ); | ||||
foreach ($modes as $mode) { | foreach ($modes as $mode) { | ||||
$actual = id(clone $finder) | $actual = id(clone $finder) | ||||
->setForceMode($mode) | ->setForceMode($mode) | ||||
->find(); | ->find(); | ||||
if ($finder->getGenerateChecksums()) { | if ($finder->getGenerateChecksums()) { | ||||
ksort($actual); | ksort($actual); | ||||
} else { | } else { | ||||
Show All 11 Lines |