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

Side by Side Diff: pkg/analysis_server/test/analysis/notification_analysis_options_test.dart

Issue 1490233007: Remove the old task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@analyzer-breaking-0.27
Patch Set: Created 5 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.analysis.notification.analysis_options; 5 library test.analysis.notification.analysis_options;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/constants.dart'; 8 import 'package:analysis_server/src/constants.dart';
9 import 'package:analysis_server/src/domain_analysis.dart'; 9 import 'package:analysis_server/src/domain_analysis.dart';
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/services/lint.dart'; 11 import 'package:analyzer/src/services/lint.dart';
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; 12 import 'package:test_reflective_loader/test_reflective_loader.dart';
13 import 'package:unittest/unittest.dart'; 13 import 'package:unittest/unittest.dart';
14 14
15 import '../analysis_abstract.dart'; 15 import '../analysis_abstract.dart';
16 import '../mocks.dart'; 16 import '../mocks.dart';
17 import '../utils.dart'; 17 import '../utils.dart';
18 18
19 main() { 19 main() {
20 initializeTestEnvironment(); 20 initializeTestEnvironment();
21 defineReflectiveTests(AnalysisOptionsFileNotificationTest); 21 defineReflectiveTests(AnalysisOptionsFileNotificationTest);
22 } 22 }
23 23
24 @reflectiveTest 24 @reflectiveTest
25 class AnalysisOptionsFileNotificationTest extends AbstractAnalysisTest { 25 class AnalysisOptionsFileNotificationTest extends AbstractAnalysisTest {
26 /// Cached model state in case tests need to set task model to on/off.
27 bool wasTaskModelEnabled;
28
29 Map<String, List<AnalysisError>> filesErrors = {}; 26 Map<String, List<AnalysisError>> filesErrors = {};
30 27
31 final testSource = ''' 28 final testSource = '''
32 main() { 29 main() {
33 var x = ''; 30 var x = '';
34 int y = x; // Not assignable in strong-mode 31 int y = x; // Not assignable in strong-mode
35 print(y); 32 print(y);
36 }'''; 33 }''';
37 34
38 List<AnalysisError> get errors => filesErrors[testFile]; 35 List<AnalysisError> get errors => filesErrors[testFile];
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 addOptionsFile(''' 68 addOptionsFile('''
72 analyzer: 69 analyzer:
73 strong-mode: $isSet 70 strong-mode: $isSet
74 '''); 71 ''');
75 } 72 }
76 73
77 @override 74 @override
78 void setUp() { 75 void setUp() {
79 super.setUp(); 76 super.setUp();
80 server.handlers = [new AnalysisDomainHandler(server)]; 77 server.handlers = [new AnalysisDomainHandler(server)];
81 wasTaskModelEnabled = AnalysisEngine.instance.useTaskModel;
82 AnalysisEngine.instance.useTaskModel = true;
83 } 78 }
84 79
85 @override 80 @override
86 void tearDown() { 81 void tearDown() {
87 AnalysisEngine.instance.useTaskModel = wasTaskModelEnabled;
88 filesErrors[optionsFilePath] = []; 82 filesErrors[optionsFilePath] = [];
89 filesErrors[testFile] = []; 83 filesErrors[testFile] = [];
90 super.tearDown(); 84 super.tearDown();
91 } 85 }
92 86
93 test_error_filter() async { 87 test_error_filter() async {
94 addOptionsFile(''' 88 addOptionsFile('''
95 analyzer: 89 analyzer:
96 errors: 90 errors:
97 unused_local_variable: ignore 91 unused_local_variable: ignore
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 AnalysisErrorType.STATIC_TYPE_WARNING, 303 AnalysisErrorType.STATIC_TYPE_WARNING,
310 AnalysisErrorType.COMPILE_TIME_ERROR 304 AnalysisErrorType.COMPILE_TIME_ERROR
311 ])); 305 ]));
312 } else { 306 } else {
313 // Should only produce a hint. 307 // Should only produce a hint.
314 expect(errors.map((error) => error.type), 308 expect(errors.map((error) => error.type),
315 unorderedEquals([AnalysisErrorType.HINT])); 309 unorderedEquals([AnalysisErrorType.HINT]));
316 } 310 }
317 } 311 }
318 } 312 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/status/tree_writer.dart ('k') | pkg/analysis_server/test/analysis/notification_errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698