Auto merge of #13447 - gterzian:check_webidls_folder_files, r=Wafflespeanut

Have tidy ensure that the there are no extra files in the webidls folder #13427

<!-- Please describe your changes on the following line: -->
 Have tidy ensure that the there are no extra files in the webidls folder #13427

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13427 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13447)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-10-02 12:00:36 -05:00 committed by GitHub
commit 3a5fd8b49a
9 changed files with 52 additions and 3 deletions

View file

@ -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])