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

Side by Side Diff: client/dom/scripts/dartgenerator_test.py

Issue 9152018: Remove everything to do with snippets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 | « client/dom/scripts/dartgenerator.py ('k') | client/dom/scripts/databasebuilder.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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """Tests for dartgenerator.""" 6 """Tests for dartgenerator."""
7 7
8 import logging.config 8 import logging.config
9 import os.path 9 import os.path
10 import re 10 import re
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 FILE CONTENT: 70 FILE CONTENT:
71 %s 71 %s
72 """ % (expected_content, file_path, actual_content) 72 """ % (expected_content, file_path, actual_content)
73 self.fail(msg) 73 self.fail(msg)
74 74
75 def setUp(self): 75 def setUp(self):
76 self._working_dir = tempfile.mkdtemp() 76 self._working_dir = tempfile.mkdtemp()
77 self._output_dir = os.path.join(self._working_dir, 'output') 77 self._output_dir = os.path.join(self._working_dir, 'output')
78 self._database_dir = os.path.join(self._working_dir, 'database') 78 self._database_dir = os.path.join(self._working_dir, 'database')
79 self._auxiliary_dir = os.path.join(self._working_dir, 'auxiliary') 79 self._auxiliary_dir = os.path.join(self._working_dir, 'auxiliary')
80 self._snippet_dir = os.path.join(self._working_dir, 'snippet')
81 self.assertFalse(os.path.exists(self._database_dir)) 80 self.assertFalse(os.path.exists(self._database_dir))
82 81
83 # Create database and add one interface. 82 # Create database and add one interface.
84 db = database.Database(self._database_dir) 83 db = database.Database(self._database_dir)
85 os.mkdir(self._auxiliary_dir) 84 os.mkdir(self._auxiliary_dir)
86 os.mkdir(self._snippet_dir)
87 self.assertTrue(os.path.exists(self._database_dir)) 85 self.assertTrue(os.path.exists(self._database_dir))
88 86
89 content = """ 87 content = """
90 module shapes { 88 module shapes {
91 @A1 @A2 89 @A1 @A2
92 interface Shape { 90 interface Shape {
93 @A1 @A2 getter attribute int attr; 91 @A1 @A2 getter attribute int attr;
94 @A1 setter attribute int attr; 92 @A1 setter attribute int attr;
95 @A3 boolean op(); 93 @A3 boolean op();
96 const long CONSTANT = 1; 94 const long CONSTANT = 1;
(...skipping 29 matching lines...) Expand all
126 for interface in module.interfaces: 124 for interface in module.interfaces:
127 db.AddInterface(interface) 125 db.AddInterface(interface)
128 db.Save() 126 db.Save()
129 127
130 self.assertTrue(self._InDatabase('Shape')) 128 self.assertTrue(self._InDatabase('Shape'))
131 self.assertTrue(self._InDatabase('Rectangle')) 129 self.assertTrue(self._InDatabase('Rectangle'))
132 self.assertTrue(self._InDatabase('Line')) 130 self.assertTrue(self._InDatabase('Line'))
133 131
134 self._database = database.Database(self._database_dir) 132 self._database = database.Database(self._database_dir)
135 self._generator = dartgenerator.DartGenerator(self._auxiliary_dir, 133 self._generator = dartgenerator.DartGenerator(self._auxiliary_dir,
136 self._snippet_dir,
137 'test') 134 'test')
138 135
139 def tearDown(self): 136 def tearDown(self):
140 shutil.rmtree(self._database_dir) 137 shutil.rmtree(self._database_dir)
141 shutil.rmtree(self._auxiliary_dir) 138 shutil.rmtree(self._auxiliary_dir)
142 shutil.rmtree(self._snippet_dir)
143 139
144 def testBasicGeneration(self): 140 def testBasicGeneration(self):
145 # Generate all interfaces: 141 # Generate all interfaces:
146 self._database.Load() 142 self._database.Load()
147 self._generator.Generate(self._database, self._output_dir) 143 self._generator.Generate(self._database, self._output_dir)
148 self._generator.Flush() 144 self._generator.Flush()
149 145
150 self.assertTrue(self._InOutput('Shape')) 146 self.assertTrue(self._InOutput('Shape'))
151 self.assertTrue(self._InOutput('Rectangle')) 147 self.assertTrue(self._InOutput('Rectangle'))
152 self.assertTrue(self._InOutput('Line')) 148 self.assertTrue(self._InOutput('Line'))
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 # Verify template conversion: 223 # Verify template conversion:
228 # TODO(vsm): Re-enable when core collections are supported. 224 # TODO(vsm): Re-enable when core collections are supported.
229 # self._AssertOutputContains('rectangles', 'Rectangle', 225 # self._AssertOutputContains('rectangles', 'Rectangle',
230 # 'void someTemplatedType(List<Shape> list)') 226 # 'void someTemplatedType(List<Shape> list)')
231 227
232 228
233 if __name__ == '__main__': 229 if __name__ == '__main__':
234 logging.config.fileConfig('logging.conf') 230 logging.config.fileConfig('logging.conf')
235 if __name__ == '__main__': 231 if __name__ == '__main__':
236 unittest.main() 232 unittest.main()
OLDNEW
« no previous file with comments | « client/dom/scripts/dartgenerator.py ('k') | client/dom/scripts/databasebuilder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698