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

Side by Side Diff: native_client_sdk/src/build_tools/tests/easy_template_test.py

Issue 250773010: [NaCl SDK] easy_template: fix bug when using % in an expression template. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix % after {{}} bug Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/build_tools/easy_template.py ('k') | no next file » | 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 cStringIO 6 import cStringIO
7 import difflib 7 import difflib
8 import os 8 import os
9 import sys 9 import sys
10 import unittest 10 import unittest
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 struct Foo { 102 struct Foo {
103 std::string name; 103 std::string name;
104 int problems[99]; 104 int problems[99];
105 };""" 105 };"""
106 self._RunTest(template, expected, { 106 self._RunTest(template, expected, {
107 'name': 'Foo', 107 'name': 'Foo',
108 'fields': [ 108 'fields': [
109 {'name': 'name', 'type': 'std::string'}, 109 {'name': 'name', 'type': 'std::string'},
110 {'name': 'problems', 'type': 'array', 'basetype': 'int', 'size': 99}]}) 110 {'name': 'problems', 'type': 'array', 'basetype': 'int', 'size': 99}]})
111 111
112 def testModulo(self):
113 self._RunTest('No expression %', 'No expression %', {})
114 self._RunTest('% before {{3 + 4}}', '% before 7', {})
115 self._RunTest('{{2**8}} % after', '256 % after', {})
116 self._RunTest('inside {{8 % 3}}', 'inside 2', {})
117 self._RunTest('Everywhere % {{8 % 3}} %', 'Everywhere % 2 %', {})
118
112 119
113 if __name__ == '__main__': 120 if __name__ == '__main__':
114 unittest.main() 121 unittest.main()
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/easy_template.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698