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

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

Issue 1062573004: [Extension API Extern Generation] Fix a few bugs in extern generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dan's Created 5 years, 8 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
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 from code import Code 6 from code import Code
7 import unittest 7 import unittest
8 8
9 class CodeTest(unittest.TestCase): 9 class CodeTest(unittest.TestCase):
10 def testAppend(self): 10 def testAppend(self):
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 '/**\n' 184 '/**\n'
185 ' * @typedef {{\n' 185 ' * @typedef {{\n'
186 ' * foo: bar,\n' 186 ' * foo: bar,\n'
187 ' * baz: {\n' 187 ' * baz: {\n'
188 ' * x: y\n' 188 ' * x: y\n'
189 ' * }\n' 189 ' * }\n'
190 ' * }}\n' 190 ' * }}\n'
191 ' */', 191 ' */',
192 output) 192 output)
193 193
194 def testSameLineAppendAndConcat(self): 194 def testSameLineAppendConcatComment(self):
195 c = Code() 195 c = Code()
196 c.Append('This is a line.') 196 c.Append('This is a line.')
197 c.Append('This too.', new_line=False) 197 c.Append('This too.', new_line=False)
198 d = Code() 198 d = Code()
199 d.Append('And this.') 199 d.Append('And this.')
200 c.Concat(d, new_line=False) 200 c.Concat(d, new_line=False)
201 self.assertEquals('This is a line.This too.And this.', c.Render()) 201 self.assertEquals('This is a line.This too.And this.', c.Render())
202 c = Code()
203 c.Append('This is a')
204 c.Comment(' spectacular 80-character line thingy ' +
205 'that fits wonderfully everywhere.',
206 comment_prefix='',
207 new_line=False)
208 self.assertEquals('This is a spectacular 80-character line thingy that ' +
209 'fits wonderfully everywhere.',
210 c.Render())
202 211
203 if __name__ == '__main__': 212 if __name__ == '__main__':
204 unittest.main() 213 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698