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

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

Issue 9491002: json_schema_compiler: any, additionalProperties, functions on types (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add any in arrays to util.h Created 8 years, 9 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 unified diff | Download patch
« no previous file with comments | « tools/json_schema_compiler/code.py ('k') | tools/json_schema_compiler/compiler.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from code import Code 5 from code import Code
6 import unittest 6 import unittest
7 7
8 class CodeTest(unittest.TestCase): 8 class CodeTest(unittest.TestCase):
9 def testAppend(self): 9 def testAppend(self):
10 c = Code() 10 c = Code()
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 '// word, length', 141 '// word, length',
142 c.Render()) 142 c.Render())
143 long_word = 'x' * 100 143 long_word = 'x' * 100
144 c = Code() 144 c = Code()
145 c.Comment(long_word) 145 c.Comment(long_word)
146 self.assertEquals( 146 self.assertEquals(
147 '// ' + 'x' * 77 + '\n' 147 '// ' + 'x' * 77 + '\n'
148 '// ' + 'x' * 23, 148 '// ' + 'x' * 23,
149 c.Render()) 149 c.Render())
150 150
151 def testCommentWithSpecialCharacters(self):
152 c = Code()
153 c.Comment('20% of 80%s')
154 c.Substitute({})
155 self.assertEquals('// 20% of 80%s', c.Render())
156 d = Code()
157 d.Append('90')
158 d.Concat(c)
159 self.assertEquals('90\n'
160 '// 20% of 80%s',
161 d.Render())
162
151 if __name__ == '__main__': 163 if __name__ == '__main__':
152 unittest.main() 164 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/code.py ('k') | tools/json_schema_compiler/compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698