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

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

Issue 2514533002: update ContextManager to support analysis option include directive (Closed)
Patch Set: merge Created 4 years, 1 month 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
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/context_manager.dart'; 9 import 'package:analysis_server/src/context_manager.dart';
10 import 'package:analyzer/error/error.dart'; 10 import 'package:analyzer/error/error.dart';
11 import 'package:analyzer/file_system/file_system.dart'; 11 import 'package:analyzer/file_system/file_system.dart';
12 import 'package:analyzer/file_system/memory_file_system.dart'; 12 import 'package:analyzer/file_system/memory_file_system.dart';
13 import 'package:analyzer/instrumentation/instrumentation.dart'; 13 import 'package:analyzer/instrumentation/instrumentation.dart';
14 import 'package:analyzer/source/analysis_options_provider.dart';
14 import 'package:analyzer/source/error_processor.dart'; 15 import 'package:analyzer/source/error_processor.dart';
15 import 'package:analyzer/src/context/builder.dart'; 16 import 'package:analyzer/src/context/builder.dart';
16 import 'package:analyzer/src/dart/analysis/driver.dart'; 17 import 'package:analyzer/src/dart/analysis/driver.dart';
17 import 'package:analyzer/src/error/codes.dart'; 18 import 'package:analyzer/src/error/codes.dart';
18 import 'package:analyzer/src/generated/engine.dart'; 19 import 'package:analyzer/src/generated/engine.dart';
19 import 'package:analyzer/src/generated/sdk.dart'; 20 import 'package:analyzer/src/generated/sdk.dart';
20 import 'package:analyzer/src/generated/source.dart'; 21 import 'package:analyzer/src/generated/source.dart';
21 import 'package:analyzer/src/generated/source_io.dart'; 22 import 'package:analyzer/src/generated/source_io.dart';
22 import 'package:analyzer/src/services/lint.dart'; 23 import 'package:analyzer/src/services/lint.dart';
23 import 'package:analyzer/src/task/options.dart' 24 import 'package:analyzer/src/task/options.dart'
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 await pumpEventQueue(); 1929 await pumpEventQueue();
1929 1930
1930 // Verify defaults restored. 1931 // Verify defaults restored.
1931 expect(options.enableGenericMethods, isFalse); 1932 expect(options.enableGenericMethods, isFalse);
1932 expect(lints, hasLength(1)); 1933 expect(lints, hasLength(1));
1933 expect(lints.first, new isInstanceOf<AvoidAs>()); 1934 expect(lints.first, new isInstanceOf<AvoidAs>());
1934 expect(errorProcessors, hasLength(1)); 1935 expect(errorProcessors, hasLength(1));
1935 expect(getProcessor(missing_return).severity, isNull); 1936 expect(getProcessor(missing_return).severity, isNull);
1936 } 1937 }
1937 1938
1939 test_analysis_options_include() async {
1940 // Create files.
1941 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
1942 newFile([libPath, 'main.dart']);
1943 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
1944 newFile([sdkExtPath, 'entry.dart']);
1945 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
1946 newFile([sdkExtSrcPath, 'part.dart']);
1947 // Setup analysis options file which includes another options file.
1948 newFile(
1949 [projPath, optionsFileName],
1950 r'''
1951 include: other_options.yaml
1952 ''');
1953 newFile(
1954 [projPath, 'other_options.yaml'],
1955 r'''
1956 analyzer:
1957 language:
1958 enableGenericMethods: true
1959 errors:
1960 unused_local_variable: false
1961 linter:
1962 rules:
1963 - camel_case_types
1964 ''');
1965 // Setup context.
1966 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
1967 await pumpEventQueue();
1968
1969 // Verify options were set.
1970 expect(options.enableGenericMethods, isTrue);
1971 expect(errorProcessors, hasLength(1));
1972 expect(lints, hasLength(1));
1973 expect(lints[0].name, 'camel_case_types');
1974 }
1975
1938 test_analysis_options_parse_failure() async { 1976 test_analysis_options_parse_failure() async {
1939 // Create files. 1977 // Create files.
1940 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 1978 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
1941 newFile([libPath, 'main.dart']); 1979 newFile([libPath, 'main.dart']);
1942 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 1980 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
1943 newFile([sdkExtPath, 'entry.dart']); 1981 newFile([sdkExtPath, 'entry.dart']);
1944 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 1982 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
1945 newFile([sdkExtSrcPath, 'part.dart']); 1983 newFile([sdkExtSrcPath, 'part.dart']);
1946 // Setup analysis options file with ignore list. 1984 // Setup analysis options file with ignore list.
1947 newFile( 1985 newFile(
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 class TestUriResolver extends UriResolver { 2805 class TestUriResolver extends UriResolver {
2768 Map<Uri, Source> uriMap; 2806 Map<Uri, Source> uriMap;
2769 2807
2770 TestUriResolver(this.uriMap); 2808 TestUriResolver(this.uriMap);
2771 2809
2772 @override 2810 @override
2773 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2811 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2774 return uriMap[uri]; 2812 return uriMap[uri];
2775 } 2813 }
2776 } 2814 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698