aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy_tests
diff options
context:
space:
mode:
authorZbynek Winkler <zbynek.winkler@gmail.com>2016-04-21 17:06:57 +0200
committerZbynek Winkler <zbynek.winkler@gmail.com>2016-04-21 17:52:09 +0200
commitb6b8ac6cd394a0ac6182c4c7aa5c500e10a6f214 (patch)
tree19a03971ad35e9718e13851eaa9f3c8afe9ed9fb /python/tidy/servo_tidy_tests
parent45562287e608f60203686435558bb8a9a614f9be (diff)
downloadservo-b6b8ac6cd394a0ac6182c4c7aa5c500e10a6f214.tar.gz
servo-b6b8ac6cd394a0ac6182c4c7aa5c500e10a6f214.zip
tidy check for vim and emacs modelines.
See https://github.com/servo/servo/issues/10719.
Diffstat (limited to 'python/tidy/servo_tidy_tests')
-rw-r--r--python/tidy/servo_tidy_tests/modeline.txt5
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py8
2 files changed, 13 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/modeline.txt b/python/tidy/servo_tidy_tests/modeline.txt
new file mode 100644
index 00000000000..2a3416953ce
--- /dev/null
+++ b/python/tidy/servo_tidy_tests/modeline.txt
@@ -0,0 +1,5 @@
+# vim: set noexpandtab:
+// vi: et:
+/* ex: et:
+anything -*-Lisp-*-
+ -*- mode: Lisp -*-
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index 031e0873a56..1c26ba17b3b 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -75,6 +75,14 @@ class CheckTidiness(unittest.TestCase):
errors = tidy.collect_errors_for_files(iterFile('test.toml'), [tidy.check_toml], [])
self.assertEqual('found asterisk instead of minimum version number', errors.next()[2])
+ def test_modeline(self):
+ errors = tidy.collect_errors_for_files(iterFile('modeline.txt'), [], [tidy.check_modeline])
+ self.assertEqual('vi modeline present', errors.next()[2])
+ self.assertEqual('vi modeline present', errors.next()[2])
+ self.assertEqual('vi modeline present', errors.next()[2])
+ self.assertEqual('emacs file variables present', errors.next()[2])
+ self.assertEqual('emacs file variables present', errors.next()[2])
+
def do_tests():
suite = unittest.TestLoader().loadTestsFromTestCase(CheckTidiness)