aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy_tests
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-07-07 20:12:38 -0700
committerGitHub <noreply@github.com>2016-07-07 20:12:38 -0700
commit34e53b1dca2202b1644e44258d67e52334e15bc4 (patch)
treedb99681080bbbb4bdb2fa42046a9b9589ade1af9 /python/tidy/servo_tidy_tests
parent9c00331634c2c753637a873f600b9804e6145e62 (diff)
parent28399d0877c78926984a16a51cb5d7921b357a0b (diff)
downloadservo-34e53b1dca2202b1644e44258d67e52334e15bc4.tar.gz
servo-34e53b1dca2202b1644e44258d67e52334e15bc4.zip
Auto merge of #12317 - tallowen:add-tidy-test, r=jdm
[tidy] Test json parsing functionality We didn't have a test for json parsing so lets start with that --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12317) <!-- Reviewable:end -->
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"