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

Side by Side Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 2946313003: Restore partial analysis of analysis options files (Closed)
Patch Set: Created 3 years, 6 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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.context.directory.manager; 5 library test.context.directory.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/context_manager.dart'; 10 import 'package:analysis_server/src/context_manager.dart';
11 import 'package:analysis_server/src/plugin/notification_manager.dart';
11 import 'package:analysis_server/src/utilities/null_string_sink.dart'; 12 import 'package:analysis_server/src/utilities/null_string_sink.dart';
12 import 'package:analyzer/context/context_root.dart'; 13 import 'package:analyzer/context/context_root.dart';
13 import 'package:analyzer/error/error.dart'; 14 import 'package:analyzer/error/error.dart';
14 import 'package:analyzer/file_system/file_system.dart'; 15 import 'package:analyzer/file_system/file_system.dart';
15 import 'package:analyzer/file_system/memory_file_system.dart'; 16 import 'package:analyzer/file_system/memory_file_system.dart';
16 import 'package:analyzer/instrumentation/instrumentation.dart'; 17 import 'package:analyzer/instrumentation/instrumentation.dart';
17 import 'package:analyzer/source/error_processor.dart'; 18 import 'package:analyzer/source/error_processor.dart';
18 import 'package:analyzer/src/context/builder.dart'; 19 import 'package:analyzer/src/context/builder.dart';
19 import 'package:analyzer/src/dart/analysis/driver.dart'; 20 import 'package:analyzer/src/dart/analysis/driver.dart';
20 import 'package:analyzer/src/dart/analysis/file_state.dart'; 21 import 'package:analyzer/src/dart/analysis/file_state.dart';
(...skipping 11 matching lines...) Expand all
32 import 'package:linter/src/rules/avoid_as.dart'; 33 import 'package:linter/src/rules/avoid_as.dart';
33 import 'package:path/path.dart' as path; 34 import 'package:path/path.dart' as path;
34 import 'package:plugin/manager.dart'; 35 import 'package:plugin/manager.dart';
35 import 'package:plugin/plugin.dart'; 36 import 'package:plugin/plugin.dart';
36 import 'package:test/test.dart'; 37 import 'package:test/test.dart';
37 import 'package:test_reflective_loader/test_reflective_loader.dart'; 38 import 'package:test_reflective_loader/test_reflective_loader.dart';
38 import 'package:watcher/watcher.dart'; 39 import 'package:watcher/watcher.dart';
39 40
40 import 'mock_sdk.dart'; 41 import 'mock_sdk.dart';
41 import 'mocks.dart'; 42 import 'mocks.dart';
43 import 'src/plugin/plugin_manager_test.dart';
42 44
43 main() { 45 main() {
44 defineReflectiveSuite(() { 46 defineReflectiveSuite(() {
45 defineReflectiveTests(AbstractContextManagerTest); 47 defineReflectiveTests(AbstractContextManagerTest);
46 defineReflectiveTests(ContextManagerWithNewOptionsTest); 48 defineReflectiveTests(ContextManagerWithNewOptionsTest);
47 defineReflectiveTests(ContextManagerWithOldOptionsTest); 49 defineReflectiveTests(ContextManagerWithOldOptionsTest);
48 }); 50 });
49 } 51 }
50 52
51 @reflectiveTest 53 @reflectiveTest
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 2029
2028 test_analysis_options_parse_failure() async { 2030 test_analysis_options_parse_failure() async {
2029 // Create files. 2031 // Create files.
2030 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2032 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2031 newFile([libPath, 'main.dart']); 2033 newFile([libPath, 'main.dart']);
2032 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 2034 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
2033 newFile([sdkExtPath, 'entry.dart']); 2035 newFile([sdkExtPath, 'entry.dart']);
2034 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 2036 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
2035 newFile([sdkExtSrcPath, 'part.dart']); 2037 newFile([sdkExtSrcPath, 'part.dart']);
2036 // Setup analysis options file with ignore list. 2038 // Setup analysis options file with ignore list.
2037 newFile( 2039 String optionsFilePath = newFile(
2038 [projPath, optionsFileName], 2040 [projPath, optionsFileName],
2039 r''' 2041 r'''
2040 ; 2042 ;
2041 '''); 2043 ''');
2042 // Setup context. 2044 // Setup context.
2043 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2045 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2044 2046
2045 // No error means success. 2047 // Check that an error was produced.
2048 TestNotificationManager notificationManager = callbacks.notificationManager;
2049 var errors = notificationManager.recordedErrors;
2050 expect(errors, hasLength(1));
2051 expect(errors[errors.keys.first][optionsFilePath], hasLength(1));
2046 } 2052 }
2047 2053
2048 test_deleteRoot_hasAnalysisOptions() async { 2054 test_deleteRoot_hasAnalysisOptions() async {
2049 newFile([projPath, optionsFileName], ''); 2055 newFile([projPath, optionsFileName], '');
2050 2056
2051 // Add the root. 2057 // Add the root.
2052 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2058 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2053 await pumpEventQueue(); 2059 await pumpEventQueue();
2054 2060
2055 // Remove the root, with the analysis options file. 2061 // Remove the root, with the analysis options file.
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 /** 2586 /**
2581 * The list of `flushedFiles` in the last [removeContext] invocation. 2587 * The list of `flushedFiles` in the last [removeContext] invocation.
2582 */ 2588 */
2583 List<String> lastFlushedFiles; 2589 List<String> lastFlushedFiles;
2584 2590
2585 /** 2591 /**
2586 * The watch events that have been broadcast. 2592 * The watch events that have been broadcast.
2587 */ 2593 */
2588 List<WatchEvent> watchEvents = <WatchEvent>[]; 2594 List<WatchEvent> watchEvents = <WatchEvent>[];
2589 2595
2596 @override
2597 NotificationManager notificationManager = new TestNotificationManager();
2598
2590 TestContextManagerCallbacks( 2599 TestContextManagerCallbacks(
2591 this.resourceProvider, this.sdkManager, this.logger, this.scheduler); 2600 this.resourceProvider, this.sdkManager, this.logger, this.scheduler);
2592 2601
2593 /** 2602 /**
2594 * Return the current set of analysis options. 2603 * Return the current set of analysis options.
2595 */ 2604 */
2596 AnalysisOptions get analysisOptions => currentDriver == null 2605 AnalysisOptions get analysisOptions => currentDriver == null
2597 ? currentContext.analysisOptions 2606 ? currentContext.analysisOptions
2598 : currentDriver.analysisOptions; 2607 : currentDriver.analysisOptions;
2599 2608
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 class TestUriResolver extends UriResolver { 2836 class TestUriResolver extends UriResolver {
2828 Map<Uri, Source> uriMap; 2837 Map<Uri, Source> uriMap;
2829 2838
2830 TestUriResolver(this.uriMap); 2839 TestUriResolver(this.uriMap);
2831 2840
2832 @override 2841 @override
2833 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2842 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2834 return uriMap[uri]; 2843 return uriMap[uri];
2835 } 2844 }
2836 } 2845 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698