diff options
-rw-r--r-- | python/tidy/servo_tidy_tests/malformed_json.json | 4 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/malformed_json.json b/python/tidy/servo_tidy_tests/malformed_json.json new file mode 100644 index 00000000000..9b1cf7cbd88 --- /dev/null +++ b/python/tidy/servo_tidy_tests/malformed_json.json @@ -0,0 +1,4 @@ +{ + "key": "value", + "other_key": "value_with_bad_quote' +} diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 4a90f94b6b9..096fb5676b2 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -104,6 +104,11 @@ class CheckTidiness(unittest.TestCase): self.assertEqual('emacs file variables present', errors.next()[2]) self.assertNoMoreErrors(errors) + def test_malformed_json(self): + errors = tidy.collect_errors_for_files(iterFile('malformed_json.json'), [tidy.check_json], [], print_text=False) + self.assertEqual('Invalid control character at: line 3 column 40 (char 61)', errors.next()[2]) + self.assertNoMoreErrors(errors) + def test_lock(self): errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [], print_text=False) msg = """duplicate versions for package "test" |