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

Unified Diff: tools/json_schema_compiler/json_parse_test.py

Issue 11079010: Extensions Docs Server: Preserve JSON declaration order in extensions documentation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more efficient ordered_dict Created 8 years, 2 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
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()

Powered by Google App Engine
This is Rietveld 408576698