summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT_test.py
diff options
context:
space:
mode:
authoryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 11:41:53 +0000
committeryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 11:41:53 +0000
commita334327dbe1cf1fa520dd90be8476d920e09d5de (patch)
tree070b038751325c0a18b945874aaf47d2614c367a /PRESUBMIT_test.py
parent07861dcea249265dac92120524230dd2511d0281 (diff)
downloadchromium_src-a334327dbe1cf1fa520dd90be8476d920e09d5de.zip
chromium_src-a334327dbe1cf1fa520dd90be8476d920e09d5de.tar.gz
chromium_src-a334327dbe1cf1fa520dd90be8476d920e09d5de.tar.bz2
Make JSON validity presubmit test less stringent.
On Mac, Python 2.7 gives different results (line 1 column 3 char 2) than Python 2.6 (line 1 column 2 char 2). Review URL: https://codereview.chromium.org/335263002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT_test.py')
-rwxr-xr-xPRESUBMIT_test.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 5a682a1..f81b316 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()