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

Side by Side Diff: tools/json_schema_compiler/idl_schema_test.py

Issue 11565053: Allow leading underscore on identifier names in IDL parser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added test file that I forgot in first patchset Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/generators/idl_lexer.py ('k') | tools/json_schema_compiler/test/idl_reserved_words.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import idl_schema 6 import idl_schema
7 import unittest 7 import unittest
8 8
9 def getFunction(schema, name): 9 def getFunction(schema, name):
10 for item in schema['functions']: 10 for item in schema['functions']:
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 [{'description': ('So should this comment about the argument. ' 114 [{'description': ('So should this comment about the argument. '
115 '<em>HTML</em> is fine too.'), 115 '<em>HTML</em> is fine too.'),
116 'name': 'arg', 116 'name': 'arg',
117 '$ref': 'idl_basics.MyType1'}], 117 '$ref': 'idl_basics.MyType1'}],
118 func['parameters']) 118 func['parameters'])
119 func = getFunction(schema, 'function4') 119 func = getFunction(schema, 'function4')
120 self.assertEquals(('This tests if "double-quotes" are escaped correctly.' 120 self.assertEquals(('This tests if "double-quotes" are escaped correctly.'
121 '<br/><br/> It also tests a comment with two newlines.'), 121 '<br/><br/> It also tests a comment with two newlines.'),
122 func['description']) 122 func['description'])
123 123
124 def testReservedWords(self):
125 schema = idl_schema.Load('test/idl_reserved_words.idl')[0]
126
127 foo_type = getType(schema, 'reserved_words.Foo')
128 self.assertEquals(['float', 'DOMString'], foo_type['enum'])
129
130 enum_type = getType(schema, 'reserved_words.enum')
131 self.assertEquals(['callback', 'namespace'], enum_type['enum'])
132
133 dictionary = getType(schema, 'reserved_words.dictionary');
134 self.assertEquals('integer', dictionary['properties']['long']['type'])
135
136 mytype = getType(schema, 'reserved_words.MyType')
137 self.assertEquals('string', mytype['properties']['interface']['type'])
138
139 params = getParams(schema, 'static')
140 self.assertEquals('reserved_words.Foo', params[0]['$ref'])
141 self.assertEquals('reserved_words.enum', params[1]['$ref'])
142
124 if __name__ == '__main__': 143 if __name__ == '__main__':
125 unittest.main() 144 unittest.main()
OLDNEW
« no previous file with comments | « ppapi/generators/idl_lexer.py ('k') | tools/json_schema_compiler/test/idl_reserved_words.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698