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

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

Issue 2590593003: new test for analysis options include directive (Closed)
Patch Set: merge 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
« no previous file with comments | « no previous file | 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:analysis_server/src/utilities/null_string_sink.dart'; 10 import 'package:analysis_server/src/utilities/null_string_sink.dart';
(...skipping 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 // Setup context. 2129 // Setup context.
2130 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2130 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2131 await pumpEventQueue(); 2131 await pumpEventQueue();
2132 // Verify options were set. 2132 // Verify options were set.
2133 expect(analysisOptions.enableStrictCallChecks, isTrue); 2133 expect(analysisOptions.enableStrictCallChecks, isTrue);
2134 expect(errorProcessors, hasLength(1)); 2134 expect(errorProcessors, hasLength(1));
2135 expect(lints, hasLength(1)); 2135 expect(lints, hasLength(1));
2136 expect(lints[0].name, 'camel_case_types'); 2136 expect(lints[0].name, 'camel_case_types');
2137 } 2137 }
2138 2138
2139 test_analysis_options_include_package() async {
2140 // Create files.
2141 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2142 newFile([libPath, 'main.dart']);
2143 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
2144 newFile([sdkExtPath, 'entry.dart']);
2145 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
2146 newFile([sdkExtSrcPath, 'part.dart']);
2147 // Setup package
2148 String booLibPosixPath = '/my/pkg/boo/lib';
2149 newFile(
2150 [booLibPosixPath, 'other_options.yaml'],
2151 r'''
2152 analyzer:
2153 language:
2154 enableStrictCallChecks: true
2155 errors:
2156 unused_local_variable: false
2157 linter:
2158 rules:
2159 - camel_case_types
2160 ''');
2161 // Setup analysis options file which includes another options file.
2162 newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME],
2163 'boo:$booLibPosixPath\n');
2164 newFile(
2165 [projPath, optionsFileName],
2166 r'''
2167 include: package:boo/other_options.yaml
2168 ''');
2169 // Setup context.
2170 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2171 await pumpEventQueue();
2172 // Verify options were set.
2173 expect(analysisOptions.enableStrictCallChecks, isTrue);
2174 expect(errorProcessors, hasLength(1));
2175 expect(lints, hasLength(1));
2176 expect(lints[0].name, 'camel_case_types');
2177 }
2178
2139 test_analysis_options_parse_failure() async { 2179 test_analysis_options_parse_failure() async {
2140 // Create files. 2180 // Create files.
2141 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2181 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2142 newFile([libPath, 'main.dart']); 2182 newFile([libPath, 'main.dart']);
2143 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 2183 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
2144 newFile([sdkExtPath, 'entry.dart']); 2184 newFile([sdkExtPath, 'entry.dart']);
2145 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 2185 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
2146 newFile([sdkExtSrcPath, 'part.dart']); 2186 newFile([sdkExtSrcPath, 'part.dart']);
2147 // Setup analysis options file with ignore list. 2187 // Setup analysis options file with ignore list.
2148 newFile( 2188 newFile(
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
2952 class TestUriResolver extends UriResolver { 2992 class TestUriResolver extends UriResolver {
2953 Map<Uri, Source> uriMap; 2993 Map<Uri, Source> uriMap;
2954 2994
2955 TestUriResolver(this.uriMap); 2995 TestUriResolver(this.uriMap);
2956 2996
2957 @override 2997 @override
2958 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2998 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2959 return uriMap[uri]; 2999 return uriMap[uri];
2960 } 3000 }
2961 } 3001 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698