aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy_tests
diff options
context:
space:
mode:
authorOwen Coutts <owen@owencoutts.com>2016-07-06 19:20:58 +0200
committerOwen Coutts <owen@owencoutts.com>2016-07-07 17:07:03 +0200
commit28399d0877c78926984a16a51cb5d7921b357a0b (patch)
tree0b4f973bdae2c967a50648c6d5075c87ee20b73c /python/tidy/servo_tidy_tests
parent4fafcb121f807c31593bd2f8731358c68b3b7810 (diff)
downloadservo-28399d0877c78926984a16a51cb5d7921b357a0b.tar.gz
servo-28399d0877c78926984a16a51cb5d7921b357a0b.zip
[tidy] Add test for existing json functionality
Diffstat (limited to 'python/tidy/servo_tidy_tests')
-rw-r--r--python/tidy/servo_tidy_tests/malformed_json.json4
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py5
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"