mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
tidy: checking directories for unexpected file extensions
update config, check_dir func to use config pass only_changed_files and exclude_dirs as args simplify config better conditional remove unused default, amend error message undo doc change
This commit is contained in:
parent
2474393d15
commit
1f99381720
8 changed files with 47 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from servo_tidy import tidy
|
||||
|
||||
base_path = 'servo_tidy_tests/' if os.path.exists('servo_tidy_tests/') else 'python/tidy/servo_tidy_tests/'
|
||||
|
@ -30,6 +31,17 @@ class CheckTidiness(unittest.TestCase):
|
|||
self.assertEqual('invalid config table [wrong]', errors.next()[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_directory_checks(self):
|
||||
dirs = {
|
||||
os.path.join(base_path, "dir_check/webidl_plus"): ['webidl', 'test'],
|
||||
os.path.join(base_path, "dir_check/only_webidl"): ['webidl']
|
||||
}
|
||||
errors = tidy.check_directory_files(dirs)
|
||||
error_dir = os.path.join(base_path, "dir_check/webidl_plus")
|
||||
self.assertEqual("Unexpected extension found for test.rs. We only expect files with webidl, test extensions in {0}".format(error_dir), errors.next()[2])
|
||||
self.assertEqual("Unexpected extension found for test2.rs. We only expect files with webidl, test extensions in {0}".format(error_dir), errors.next()[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_spaces_correctnes(self):
|
||||
errors = tidy.collect_errors_for_files(iterFile('wrong_space.rs'), [], [tidy.check_by_line], print_text=False)
|
||||
self.assertEqual('trailing whitespace', errors.next()[2])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue