Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: PRESUBMIT_test.py

Issue 335263002: Make JSON validity presubmit test less stringent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT_test.py
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 5a682a13390b1a57e89ad15c417c512fd3d29b1b..f81b316aa2e025c261369e86d4ed32d106236493 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -470,17 +470,17 @@ class JSONParsingTest(unittest.TestCase):
test_data = [
('invalid_json_1.json',
['{ x }'],
- 'Expecting property name: line 1 column 2 (char 2)'),
+ 'Expecting property name:'),
('invalid_json_2.json',
['// Hello world!',
'{ "hello": "world }'],
- 'Unterminated string starting at: line 2 column 12 (char 12)'),
+ 'Unterminated string starting at:'),
('invalid_json_3.json',
['{ "a": "b", "c": "d", }'],
- 'Expecting property name: line 1 column 22 (char 22)'),
+ 'Expecting property name:'),
('invalid_json_4.json',
['{ "a": "b" "c": "d" }'],
- 'Expecting , delimiter: line 1 column 11 (char 11)'),
+ 'Expecting , delimiter:'),
]
input_api.files = [MockFile(filename, contents)
@@ -488,7 +488,8 @@ class JSONParsingTest(unittest.TestCase):
for (filename, _, expected_error) in test_data:
actual_error = PRESUBMIT._GetJSONParseError(input_api, filename)
- self.assertEqual(expected_error, str(actual_error))
+ self.assertTrue(expected_error in str(actual_error),
+ "'%s' not found in '%s'" % (expected_error, actual_error))
def testNoEatComments(self):
input_api = MockInputApi()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698