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

Side by Side Diff: third_party/closure_linter/closure_linter/not_strict_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 2011 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 """Tests for gjslint --nostrict.
18
19 Tests errors that can be thrown by gjslint when not in strict mode.
20 """
21
22
23
24 import os
25 import sys
26 import unittest
27
28 import gflags as flags
29 import unittest as googletest
30
31 from closure_linter import errors
32 from closure_linter import runner
33 from closure_linter.common import filetestcase
34
35 _RESOURCE_PREFIX = 'closure_linter/testdata'
36
37 flags.FLAGS.strict = False
38 flags.FLAGS.custom_jsdoc_tags = ('customtag', 'requires')
39 flags.FLAGS.closurized_namespaces = ('goog', 'dummy')
40 flags.FLAGS.limited_doc_files = ('externs.js', 'dummy.js',
41 'limited_doc_checks.js')
42
43
44 # List of files under testdata to test.
45 # We need to list files explicitly since pyglib can't list directories.
46 _TEST_FILES = [
47 'not_strict.js'
48 ]
49
50
51 class GJsLintTestSuite(unittest.TestSuite):
52 """Test suite to run a GJsLintTest for each of several files.
53
54 If sys.argv[1:] is non-empty, it is interpreted as a list of filenames in
55 testdata to test. Otherwise, _TEST_FILES is used.
56 """
57
58 def __init__(self, tests=()):
59 unittest.TestSuite.__init__(self, tests)
60
61 argv = sys.argv and sys.argv[1:] or []
62 if argv:
63 test_files = argv
64 else:
65 test_files = _TEST_FILES
66 for test_file in test_files:
67 resource_path = os.path.join(_RESOURCE_PREFIX, test_file)
68 self.addTest(filetestcase.AnnotatedFileTestCase(resource_path,
69 runner.Run,
70 errors.ByName))
71
72 if __name__ == '__main__':
73 # Don't let main parse args; it happens in the TestSuite.
74 googletest.main(argv=sys.argv[0:1], defaultTest='GJsLintTestSuite')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698