diff options
author | Ravi Shankar <wafflespeanut@gmail.com> | 2016-11-11 15:34:29 +0530 |
---|---|---|
committer | Ravi Shankar <wafflespeanut@gmail.com> | 2016-11-11 19:54:34 +0530 |
commit | 34955e0bf882efdd61fde3708495fbf75734c8bc (patch) | |
tree | b8f0b2c32ef0311d8d1f4c7192f711174a7c1224 /python/tidy/servo_tidy_tests/test_tidy.py | |
parent | 8385c9ae79af76e636cb6bac2366b8fea6c83a9d (diff) | |
download | servo-34955e0bf882efdd61fde3708495fbf75734c8bc.tar.gz servo-34955e0bf882efdd61fde3708495fbf75734c8bc.zip |
Add tests for the new LintRunner
Diffstat (limited to 'python/tidy/servo_tidy_tests/test_tidy.py')
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 864571528cb..a6a618d1608 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -188,6 +188,29 @@ class CheckTidiness(unittest.TestCase): self.assertEqual(msg, errors.next()[2]) self.assertNoMoreErrors(errors) + def test_lint_runner(self): + test_path = base_path + 'lints/' + runner = tidy.LintRunner(only_changed_files=False, progress=False) + runner.path = test_path + 'some-fictional-file' + self.assertEqual([(runner.path, 0, "file does not exist")], list(runner.check())) + runner.path = test_path + 'not_script' + self.assertEqual([(runner.path, 0, "lint should be a python script")], + list(runner.check())) + runner.path = test_path + 'not_inherited.py' + self.assertEqual([(runner.path, 1, "class 'Lint' should inherit from 'LintRunner'")], + list(runner.check())) + runner.path = test_path + 'no_lint.py' + self.assertEqual([(runner.path, 1, "script should contain a class named 'Lint'")], + list(runner.check())) + runner.path = test_path + 'no_run.py' + self.assertEqual([(runner.path, 0, "class 'Lint' should implement 'run' method")], + list(runner.check())) + runner.path = test_path + 'invalid_error_tuple.py' + self.assertEqual([(runner.path, 1, "errors should be a tuple of (path, line, reason)")], + list(runner.check())) + runner.path = test_path + 'proper_file.py' + self.assertEqual([('path', 0, "foobar")], list(runner.check())) + def test_file_list(self): base_path='./python/tidy/servo_tidy_tests/test_ignored' file_list = tidy.FileList(base_path, only_changed_files=False, exclude_dirs=[]) |