aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy
diff options
context:
space:
mode:
Diffstat (limited to 'python/tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py7
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py5
2 files changed, 9 insertions, 3 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 56c07aeae6b..206346675e2 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -69,6 +69,8 @@ ignored_dirs = [
os.path.join(".", "."),
]
+spec_base_path = "components/script/dom/"
+
def is_iter_empty(iterator):
try:
@@ -525,10 +527,9 @@ def check_json(filename, contents):
def check_spec(file_name, lines):
- base_path = "components/script/dom/"
- if base_path not in file_name:
+ if spec_base_path not in file_name:
raise StopIteration
- file_name = os.path.relpath(os.path.splitext(file_name)[0], base_path)
+ file_name = os.path.relpath(os.path.splitext(file_name)[0], spec_base_path)
patt = re.compile("^\s*\/\/.+")
# Pattern representing a line with a macro
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index d0e19daafb1..a183e6a798d 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -61,6 +61,11 @@ class CheckTidiness(unittest.TestCase):
self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2])
self.assertEqual('use &str instead of &String', errors.next()[2])
+ def test_spec_link(self):
+ tidy.spec_base_path = "python/tidy_self_test/"
+ errors = tidy.collect_errors_for_files(iterFile('speclink.rs'), [], [tidy.check_spec])
+ self.assertEqual('method declared in webidl is missing a comment with a specification link', errors.next()[2])
+
def test_webidl(self):
errors = tidy.collect_errors_for_files(iterFile('spec.webidl'), [tidy.check_webidl_spec], [])
self.assertEqual('No specification link found.', errors.next()[2])