aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy_tests/test_tidy.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tidy/servo_tidy_tests/test_tidy.py')
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index 4bf21cfa5e4..dca0c5765b1 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])