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

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

Issue 183763032: Add an implementation path option to json_schema_compiler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add default impl_dir Created 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/json_schema_compiler/cpp_bundle_generator.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 os 6 import os
7 import sys 7 import sys
8 import unittest 8 import unittest
9 9
10 from compiler import GenerateSchema 10 from compiler import GenerateSchema
(...skipping 14 matching lines...) Expand all
25 TESTS_DIR/test_filename.idl 25 TESTS_DIR/test_filename.idl
26 and compares it to the output in the file: 26 and compares it to the output in the file:
27 TESTS_DIR/test_filename.dart 27 TESTS_DIR/test_filename.dart
28 ''' 28 '''
29 file_rel = os.path.join(TESTS_DIR, test_filename) 29 file_rel = os.path.join(TESTS_DIR, test_filename)
30 30
31 output_dir = None 31 output_dir = None
32 if REBASE_MODE: 32 if REBASE_MODE:
33 output_dir = TESTS_DIR 33 output_dir = TESTS_DIR
34 output_code = GenerateSchema('dart', ['%s.idl' % file_rel], TESTS_DIR, 34 output_code = GenerateSchema('dart', ['%s.idl' % file_rel], TESTS_DIR,
35 output_dir, None, None) 35 output_dir, None, None, None)
36 36
37 if not REBASE_MODE: 37 if not REBASE_MODE:
38 with open('%s.dart' % file_rel) as f: 38 with open('%s.dart' % file_rel) as f:
39 expected_output = f.read() 39 expected_output = f.read()
40 # Remove the first line of the output code (as it contains the filename). 40 # Remove the first line of the output code (as it contains the filename).
41 # Also remove all blank lines, ignoring them from the comparison. 41 # Also remove all blank lines, ignoring them from the comparison.
42 # Compare with lists instead of strings for clearer diffs (especially with 42 # Compare with lists instead of strings for clearer diffs (especially with
43 # whitespace) when a test fails. 43 # whitespace) when a test fails.
44 self.assertEqual([l for l in expected_output.split('\n') if l], 44 self.assertEqual([l for l in expected_output.split('\n') if l],
45 [l for l in output_code.split('\n')[1:] if l]) 45 [l for l in output_code.split('\n')[1:] if l])
(...skipping 26 matching lines...) Expand all
72 def testTags(self): 72 def testTags(self):
73 self._RunTest('tags') 73 self._RunTest('tags')
74 74
75 75
76 if __name__ == '__main__': 76 if __name__ == '__main__':
77 if '--rebase' in sys.argv: 77 if '--rebase' in sys.argv:
78 print "Running in rebase mode." 78 print "Running in rebase mode."
79 REBASE_MODE = True 79 REBASE_MODE = True
80 sys.argv.remove('--rebase') 80 sys.argv.remove('--rebase')
81 unittest.main() 81 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/cpp_bundle_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698