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

Side by Side Diff: third_party/closure_linter/closure_linter/full_test.py

Issue 2592193002: Remove closure_linter from Chrome (Closed)
Patch Set: Created 3 years, 12 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 #
3 # Copyright 2007 The Closure Linter Authors. All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS-IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 """Full regression-type (Medium) tests for gjslint.
18
19 Tests every error that can be thrown by gjslint. Based heavily on
20 devtools/javascript/gpylint/full_test.py
21 """
22
23 __author__ = ('robbyw@google.com (Robert Walker)',
24 'ajp@google.com (Andy Perelson)')
25
26 import os
27 import sys
28 import unittest
29
30 import gflags as flags
31 import unittest as googletest
32
33 from closure_linter import error_check
34 from closure_linter import errors
35 from closure_linter import runner
36 from closure_linter.common import filetestcase
37
38 _RESOURCE_PREFIX = 'closure_linter/testdata'
39
40 flags.FLAGS.strict = True
41 flags.FLAGS.custom_jsdoc_tags = ('customtag', 'requires')
42 flags.FLAGS.closurized_namespaces = ('goog', 'dummy')
43 flags.FLAGS.limited_doc_files = ('externs.js', 'dummy.js',
44 'limited_doc_checks.js')
45 flags.FLAGS.jslint_error = error_check.Rule.ALL
46
47 # List of files under testdata to test.
48 # We need to list files explicitly since pyglib can't list directories.
49 # TODO(user): Figure out how to list the directory.
50 _TEST_FILES = [
51 'all_js_wrapped.js',
52 'blank_lines.js',
53 'ends_with_block.js',
54 'empty_file.js',
55 'externs.js',
56 'externs_jsdoc.js',
57 'goog_scope.js',
58 'html_parse_error.html',
59 'indentation.js',
60 'interface.js',
61 'jsdoc.js',
62 'limited_doc_checks.js',
63 'minimal.js',
64 'other.js',
65 'provide_blank.js',
66 'provide_extra.js',
67 'provide_missing.js',
68 'require_alias.js',
69 'require_all_caps.js',
70 'require_blank.js',
71 'require_extra.js',
72 'require_function.js',
73 'require_function_missing.js',
74 'require_function_through_both.js',
75 'require_function_through_namespace.js',
76 'require_interface.js',
77 'require_interface_alias.js',
78 'require_interface_base.js',
79 'require_lower_case.js',
80 'require_missing.js',
81 'require_numeric.js',
82 'require_provide_blank.js',
83 'require_provide_missing.js',
84 'require_provide_ok.js',
85 'semicolon_missing.js',
86 'semicolon_missing2.js',
87 'simple.html',
88 'spaces.js',
89 'tokenizer.js',
90 'unparseable.js',
91 'unused_local_variables.js',
92 'unused_private_members.js',
93 'utf8.html',
94 ]
95
96
97 class GJsLintTestSuite(unittest.TestSuite):
98 """Test suite to run a GJsLintTest for each of several files.
99
100 If sys.argv[1:] is non-empty, it is interpreted as a list of filenames in
101 testdata to test. Otherwise, _TEST_FILES is used.
102 """
103
104 def __init__(self, tests=()):
105 unittest.TestSuite.__init__(self, tests)
106
107 argv = sys.argv and sys.argv[1:] or []
108 if argv:
109 test_files = argv
110 else:
111 test_files = _TEST_FILES
112 for test_file in test_files:
113 resource_path = os.path.join(_RESOURCE_PREFIX, test_file)
114 self.addTest(
115 filetestcase.AnnotatedFileTestCase(
116 resource_path,
117 runner.Run,
118 errors.ByName))
119
120 if __name__ == '__main__':
121 # Don't let main parse args; it happens in the TestSuite.
122 googletest.main(argv=sys.argv[0:1], defaultTest='GJsLintTestSuite')
OLDNEW
« no previous file with comments | « third_party/closure_linter/closure_linter/fixjsstyle_test.py ('k') | third_party/closure_linter/closure_linter/gjslint.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698