diff options
author | Gregory <gterzian@users.noreply.github.com> | 2016-09-27 16:05:53 +0800 |
---|---|---|
committer | Gregory <gterzian@users.noreply.github.com> | 2016-10-02 14:40:28 +0800 |
commit | 1f993817203f1a096ba9fbb3cb9f7042810e44d5 (patch) | |
tree | fb009b75e25ab51db4807699bdb61c0d71b9a297 /python/tidy/servo_tidy_tests | |
parent | 2474393d15b4e6259bdcf366d3423c3a6cd2eaac (diff) | |
download | servo-1f993817203f1a096ba9fbb3cb9f7042810e44d5.tar.gz servo-1f993817203f1a096ba9fbb3cb9f7042810e44d5.zip |
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
Diffstat (limited to 'python/tidy/servo_tidy_tests')
6 files changed, 12 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/dir_check/only_webidl/test.webidl b/python/tidy/servo_tidy_tests/dir_check/only_webidl/test.webidl new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/python/tidy/servo_tidy_tests/dir_check/only_webidl/test.webidl diff --git a/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.rs b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.rs new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.rs diff --git a/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.test b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.test new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.test diff --git a/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.webidl b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.webidl new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test.webidl diff --git a/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test2.rs b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test2.rs new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/python/tidy/servo_tidy_tests/dir_check/webidl_plus/test2.rs diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 52371b944bb..72bb3e09b4f 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -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]) |