Changeset View
Changeset View
Standalone View
Standalone View
src/parser/__tests__/PhutilEditorConfigTestCase.php
- This file was added.
<?php | |||||
/** | |||||
* @group testcase | |||||
*/ | |||||
final class PhutilEditorConfigTestCase extends PhutilTestCase { | |||||
public function testGetPaths() { | |||||
$parser = new PhutilEditorConfig(dirname(phutil_get_library_root())); | |||||
$tests = array( | |||||
'file.txt' => array( | |||||
'indent_style' => 'space', | |||||
'indent_size' => 2, | |||||
'charset' => 'utf-8', | |||||
'trim_trailing_whitespace' => 1, // This should be true, but PHP. | |||||
'insert_final_newline' => 1, | |||||
), | |||||
); | |||||
foreach ($tests as $path => $config) { | |||||
foreach ($config as $key => $value) { | |||||
$this->assertEqual( | |||||
$value, | |||||
$parser->getConfig($this->getTestFile($path), $key)); | |||||
} | |||||
} | |||||
} | |||||
private function getTestFile($path) { | |||||
return dirname(__FILE__).'/editorconfig/'.$path; | |||||
} | |||||
} |