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

Side by Side 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, 4 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import argparse
7 import os
8 import unittest
9
10 from compile_modules import ModuleCompiler
11
12
13 def rel_to_abs(rel_path):
14 script_path = os.path.dirname(os.path.abspath(__file__))
15 return os.path.join(script_path, rel_path)
16
17
18 module_file = os.path.join('tests', 'test.resources')
19
20
21 class CodingConventionTest(unittest.TestCase):
22 def __init__(self, *args, **kwargs):
23 unittest.TestCase.__init__(self, *args, **kwargs)
24 self.maxDiff = None
25
26 def setUp(self):
27 self.module_compiler = ModuleCompiler(verbose=opts.verbose,
28 test_expected_output=True)
29
30 def testCodingConvention(self):
31 modules = self.module_compiler.get_modules(rel_to_abs(module_file))
32
33 for m in modules:
34 assert len(m.sources) == 1
35 s = m.sources[0]
36 output = self.module_compiler.compile_source(s, m).strip()
37 expected_output = m.expected_output.strip().split('\n')
38 for line in expected_output:
39 self.assertTrue(line in output,
40 msg='{}\n\nExpected line: \n{}\n\nOutput:\n{}\n'.format(
41 m.name, line, output))
42
43
44 if __name__ == '__main__':
45 parser = argparse.ArgumentParser()
46 parser.add_argument("-v", "--verbose", action="store_true",
47 help="Show more information as this script runs")
48 opts = parser.parse_args()
49
50 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698