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

Unified Diff: third_party/closure_compiler/coding_conventions_test.py

Issue 421253006: Add ChromeCodingConvention.java to Closure Compiler to preserve getInstance() type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@A_typechecking_about
Patch Set: Created 6 years, 5 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
Index: third_party/closure_compiler/coding_conventions_test.py
diff --git a/third_party/closure_compiler/coding_conventions_test.py b/third_party/closure_compiler/coding_conventions_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..eed1a164c24cfc7bc1636ff1a848a1f70962f5df
--- /dev/null
+++ b/third_party/closure_compiler/coding_conventions_test.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# Copyright 2014 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 argparse
+import os
+import unittest
+
+from compile_modules import ModuleCompiler
+
+
+def rel_to_abs(rel_path):
+ script_path = os.path.dirname(os.path.abspath(__file__))
+ return os.path.join(script_path, rel_path)
+
+
+module_file = os.path.join('tests', 'test.resources')
+
+
+class CodingConventionTest(unittest.TestCase):
+ def __init__(self, *args, **kwargs):
+ unittest.TestCase.__init__(self, *args, **kwargs)
+ self.maxDiff = None
+
+ def setUp(self):
+ self.module_compiler = ModuleCompiler(verbose=opts.verbose,
+ test_expected_output=True)
+
+ def testCodingConvention(self):
+ modules = self.module_compiler.get_modules(rel_to_abs(module_file))
+
+ for m in modules:
+ assert len(m.sources) == 1
+ s = m.sources[0]
+ output = self.module_compiler.compile_source(s, m).strip()
+ expected_output = m.expected_output.strip().split('\n')
+ for line in expected_output:
+ self.assertTrue(line in output,
+ msg='{}\n\nExpected line: \n{}\n\nOutput:\n{}\n'.format(
+ m.name, line, output))
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-v", "--verbose", action="store_true",
+ help="Show more information as this script runs")
+ opts = parser.parse_args()
+
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698