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

Side by Side Diff: pkg/analysis_server/test/services/linter/linter_test.dart

Issue 2553203002: Move the linter core to the analyzer package (Closed)
Patch Set: Add missed files Created 4 years 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
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.linter; 5 library test.services.linter;
6 6
7 import 'package:analysis_server/src/services/linter/linter.dart'; 7 import 'package:analysis_server/src/services/linter/linter.dart';
8 import 'package:analyzer/analyzer.dart'; 8 import 'package:analyzer/analyzer.dart';
9 import 'package:analyzer/source/analysis_options_provider.dart'; 9 import 'package:analyzer/source/analysis_options_provider.dart';
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/generated/source.dart'; 11 import 'package:analyzer/src/generated/source.dart';
12 import 'package:linter/src/rules.dart';
12 import 'package:test/test.dart'; 13 import 'package:test/test.dart';
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; 14 import 'package:test_reflective_loader/test_reflective_loader.dart';
14 15
15 main() { 16 main() {
16 defineReflectiveSuite(() { 17 defineReflectiveSuite(() {
17 defineReflectiveTests(LinterRuleOptionsValidatorTest); 18 defineReflectiveTests(LinterRuleOptionsValidatorTest);
18 }); 19 });
19 } 20 }
20 21
21 @reflectiveTest 22 @reflectiveTest
22 class LinterRuleOptionsValidatorTest { 23 class LinterRuleOptionsValidatorTest {
23 final LinterRuleOptionsValidator validator = new LinterRuleOptionsValidator(); 24 final LinterRuleOptionsValidator validator = new LinterRuleOptionsValidator();
24 final AnalysisOptionsProvider optionsProvider = new AnalysisOptionsProvider(); 25 final AnalysisOptionsProvider optionsProvider = new AnalysisOptionsProvider();
25 26
26 RecordingErrorListener recorder; 27 RecordingErrorListener recorder;
27 ErrorReporter reporter; 28 ErrorReporter reporter;
28 29
29 List<AnalysisError> get errors => recorder.errors; 30 List<AnalysisError> get errors => recorder.errors;
30 31
31 setUp() { 32 setUp() {
33 registerLintRules();
32 recorder = new RecordingErrorListener(); 34 recorder = new RecordingErrorListener();
33 reporter = new ErrorReporter(recorder, new _TestSource()); 35 reporter = new ErrorReporter(recorder, new _TestSource());
34 } 36 }
35 37
36 test_linter_defined_rules() { 38 test_linter_defined_rules() {
37 validate( 39 validate(
38 ''' 40 '''
39 linter: 41 linter:
40 rules: 42 rules:
41 - camel_case_types 43 - camel_case_types
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 validator.validate(reporter, options); 80 validator.validate(reporter, options);
79 expect(errors.map((AnalysisError e) => e.errorCode), 81 expect(errors.map((AnalysisError e) => e.errorCode),
80 unorderedEquals(expected)); 82 unorderedEquals(expected));
81 } 83 }
82 } 84 }
83 85
84 class _TestSource implements Source { 86 class _TestSource implements Source {
85 @override 87 @override
86 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 88 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
87 } 89 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/lib/src/lint/analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698