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

Unified Diff: tools/json_schema_compiler/code_test.py

Issue 1033223007: [Extension API Extern Generation] Support inline object definitions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Presubmit fix Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/code.py ('k') | tools/json_schema_compiler/h_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/code_test.py
diff --git a/tools/json_schema_compiler/code_test.py b/tools/json_schema_compiler/code_test.py
index c6ca33f5b688242fd6419896387770c701fb0a02..7d64b6c0a04490a6f5d1cdcf6be53f296324faf1 100755
--- a/tools/json_schema_compiler/code_test.py
+++ b/tools/json_schema_compiler/code_test.py
@@ -48,7 +48,7 @@ class CodeTest(unittest.TestCase):
.Append('1')
.Eblock('1')
)
- self.assertEquals(
+ self.assertMultiLineEqual(
'1\n'
' 2\n'
' 2\n'
@@ -169,5 +169,36 @@ class CodeTest(unittest.TestCase):
'// 20% of 80%s',
d.Render())
+ def testLinePrefixes(self):
+ c = Code()
+ c.Sblock(line='/**', line_prefix=' * ')
+ c.Sblock('@typedef {{')
+ c.Append('foo: bar,')
+ c.Sblock('baz: {')
+ c.Append('x: y')
+ c.Eblock('}')
+ c.Eblock('}}')
+ c.Eblock(line=' */')
+ output = c.Render()
+ self.assertMultiLineEqual(
+ '/**\n'
+ ' * @typedef {{\n'
+ ' * foo: bar,\n'
+ ' * baz: {\n'
+ ' * x: y\n'
+ ' * }\n'
+ ' * }}\n'
+ ' */',
+ output)
+
+ def testSameLineAppendAndConcat(self):
+ c = Code()
+ c.Append('This is a line.')
+ c.Append('This too.', new_line=False)
+ d = Code()
+ d.Append('And this.')
+ c.Concat(d, new_line=False)
+ self.assertEquals('This is a line.This too.And this.', c.Render())
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « tools/json_schema_compiler/code.py ('k') | tools/json_schema_compiler/h_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698