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

Unified Diff: tools/json_schema_compiler/dart_generator_test.py

Issue 12320030: Revert 183709 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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/compiler.py ('k') | tools/json_schema_compiler/dart_test/basic_event.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/dart_generator_test.py
===================================================================
--- tools/json_schema_compiler/dart_generator_test.py (revision 183749)
+++ tools/json_schema_compiler/dart_generator_test.py (working copy)
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-import unittest
-import glob
-
-from dart_generator import DartGenerator
-from compiler import GenerateSchema
-
-# If --rebase is passed to this test, this is set to True, indicating the test
-# output should be re-generated for each test (rather than running the tests
-# themselves).
-REBASE_MODE = False
-
-# The directory containing the input and expected output files corresponding
-# to each test name.
-TESTS_DIR = 'dart_test'
-
-class DartTest(unittest.TestCase):
-
- def _RunTest(self, test_filename):
- '''Given the name of a test, runs compiler.py on the file:
- TESTS_DIR/test_filename.idl
- and compares it to the output in the file:
- TESTS_DIR/test_filename.dart
- '''
- file_rel = os.path.join(TESTS_DIR, test_filename)
-
- output_dir = None
- if REBASE_MODE:
- output_dir = TESTS_DIR
- output_code = GenerateSchema('dart', ['%s.idl' % file_rel], TESTS_DIR,
- output_dir, None, None)
-
- if not REBASE_MODE:
- with open('%s.dart' % file_rel) as f:
- expected_output = f.read()
- # Remove the first line of the output code (as it contains the filename).
- # Also remove all blank lines, ignoring them from the comparison.
- # Compare with lists instead of strings for clearer diffs (especially with
- # whitespace) when a test fails.
- self.assertEqual([l for l in expected_output.split('\n') if l],
- [l for l in output_code.split('\n')[1:] if l])
-
- def setUp(self):
- # Increase the maximum diff amount to see the full diff on a failed test.
- self.maxDiff = 2000
-
- def testBasicEvent(self):
- self._RunTest('basic_event')
-
- def testBasicFunction(self):
- self._RunTest('basic_function')
-
- def testBasicType(self):
- self._RunTest('basic_type')
-
- def testComments(self):
- self._RunTest('comments')
-
- def testComplexType(self):
- self._RunTest('complex_type')
-
- def testEmptyNamespace(self):
- self._RunTest('empty_namespace')
-
- def testEmptyType(self):
- self._RunTest('empty_type')
-
- def testOpratableType(self):
- self._RunTest('operatable_type')
-
- def testTags(self):
- self._RunTest('tags')
-
-if __name__ == '__main__':
- if '--rebase' in sys.argv:
- print "Running in rebase mode."
- REBASE_MODE = True
- sys.argv.remove('--rebase')
- unittest.main()
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | tools/json_schema_compiler/dart_test/basic_event.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698