| Index: tools/json_schema_compiler/json_parse_test.py
|
| diff --git a/tools/json_schema_compiler/json_parse_test.py b/tools/json_schema_compiler/json_parse_test.py
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..cce58993989b448ded6aa887b0058ffdf228f2da
|
| --- /dev/null
|
| +++ b/tools/json_schema_compiler/json_parse_test.py
|
| @@ -0,0 +1,32 @@
|
| +#!/usr/bin/env python
|
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import json
|
| +import os
|
| +import unittest
|
| +
|
| +def _ReadTestFile(filename):
|
| + with open(os.path.join('test', filename)) as f:
|
| + return f.read()
|
| +
|
| +class JSONParseTest(unittest.TestCase):
|
| + def testParse(self):
|
| + json_str = _ReadTestFile('tabs.json')
|
| + json0 = json.loads(json_str)
|
| +
|
| + import json_parse as jp1
|
| + json1 = jp1.Parse(json_str)
|
| +
|
| + # Force use of simplejson, even in Python 2.7.
|
| + json.loads = None
|
| + import json_parse as jp2
|
| + json2 = jp2.Parse(json_str)
|
| +
|
| + self.assertEqual(json0, json1)
|
| + self.assertEqual(json0, json2)
|
| + self.assertEqual(json1, json2)
|
| +
|
| +if __name__ == '__main__':
|
| + unittest.main()
|
|
|