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

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

Issue 2361433002: Async is no longer optional (Closed)
Patch Set: Created 4 years, 2 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:collection'; 7 import 'dart:collection';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analysis_server/src/context_manager.dart'; 10 import 'package:analysis_server/src/context_manager.dart';
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 1992
1993 // Setup analysis options 1993 // Setup analysis options
1994 newFile( 1994 newFile(
1995 [projPath, optionsFileName], 1995 [projPath, optionsFileName],
1996 r''' 1996 r'''
1997 analyzer: 1997 analyzer:
1998 exclude: 1998 exclude:
1999 - 'test/**' 1999 - 'test/**'
2000 language: 2000 language:
2001 enableGenericMethods: true 2001 enableGenericMethods: true
2002 enableAsync: false
2003 errors: 2002 errors:
2004 unused_local_variable: false 2003 unused_local_variable: false
2005 linter: 2004 linter:
2006 rules: 2005 rules:
2007 - camel_case_types 2006 - camel_case_types
2008 '''); 2007 ''');
2009 2008
2010 // Setup context. 2009 // Setup context.
2011 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2010 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2012 await pumpEventQueue(); 2011 await pumpEventQueue();
2013 2012
2014 // Confirm that one context was created. 2013 // Confirm that one context was created.
2015 var contexts = 2014 var contexts =
2016 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 2015 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
2017 expect(contexts, isNotNull); 2016 expect(contexts, isNotNull);
2018 expect(contexts, hasLength(1)); 2017 expect(contexts, hasLength(1));
2019 2018
2020 var context = contexts.first; 2019 var context = contexts.first;
2021 2020
2022 // Verify options. 2021 // Verify options.
2023 // * from `config.yaml`: 2022 // * from `config.yaml`:
2024 expect(context.analysisOptions.strongMode, isTrue); 2023 expect(context.analysisOptions.strongMode, isTrue);
2025 expect(context.analysisOptions.enableSuperMixins, isTrue); 2024 expect(context.analysisOptions.enableSuperMixins, isTrue);
2026 expect(context.analysisOptions.enableAsync, isFalse);
2027 // * from analysis options: 2025 // * from analysis options:
2028 expect(context.analysisOptions.enableGenericMethods, isTrue); 2026 expect(context.analysisOptions.enableGenericMethods, isTrue);
2029 2027
2030 // * verify tests are excluded 2028 // * verify tests are excluded
2031 expect(callbacks.currentContextFilePaths[projPath].keys, 2029 expect(callbacks.currentContextFilePaths[projPath].keys,
2032 unorderedEquals(['/my/proj/$optionsFileName'])); 2030 unorderedEquals(['/my/proj/$optionsFileName']));
2033 2031
2034 // Verify filter setup. 2032 // Verify filter setup.
2035 expect(errorProcessors, hasLength(2)); 2033 expect(errorProcessors, hasLength(2));
2036 2034
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 2088
2091 // Setup analysis options 2089 // Setup analysis options
2092 newFile( 2090 newFile(
2093 [projPath, optionsFileName], 2091 [projPath, optionsFileName],
2094 r''' 2092 r'''
2095 analyzer: 2093 analyzer:
2096 exclude: 2094 exclude:
2097 - 'test/**' 2095 - 'test/**'
2098 language: 2096 language:
2099 enableGenericMethods: true 2097 enableGenericMethods: true
2100 enableAsync: false
2101 errors: 2098 errors:
2102 unused_local_variable: false 2099 unused_local_variable: false
2103 linter: 2100 linter:
2104 rules: 2101 rules:
2105 - camel_case_types 2102 - camel_case_types
2106 '''); 2103 ''');
2107 2104
2108 // Setup config.yaml. 2105 // Setup config.yaml.
2109 newFile( 2106 newFile(
2110 [libPath, 'config', 'config.yaml'], 2107 [libPath, 'config', 'config.yaml'],
(...skipping 14 matching lines...) Expand all
2125 var contexts = 2122 var contexts =
2126 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 2123 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
2127 expect(contexts, isNotNull); 2124 expect(contexts, isNotNull);
2128 expect(contexts, hasLength(1)); 2125 expect(contexts, hasLength(1));
2129 var context = contexts[0]; 2126 var context = contexts[0];
2130 2127
2131 // Verify options. 2128 // Verify options.
2132 // * from `_embedder.yaml`: 2129 // * from `_embedder.yaml`:
2133 expect(context.analysisOptions.strongMode, isTrue); 2130 expect(context.analysisOptions.strongMode, isTrue);
2134 expect(context.analysisOptions.enableSuperMixins, isTrue); 2131 expect(context.analysisOptions.enableSuperMixins, isTrue);
2135 expect(context.analysisOptions.enableAsync, isFalse);
2136 // * from analysis options: 2132 // * from analysis options:
2137 expect(context.analysisOptions.enableGenericMethods, isTrue); 2133 expect(context.analysisOptions.enableGenericMethods, isTrue);
2138 2134
2139 // * verify tests are excluded 2135 // * verify tests are excluded
2140 expect( 2136 expect(
2141 callbacks.currentContextFilePaths[projPath].keys, 2137 callbacks.currentContextFilePaths[projPath].keys,
2142 unorderedEquals( 2138 unorderedEquals(
2143 ['/my/proj/sdk_ext/entry.dart', '/my/proj/$optionsFileName'])); 2139 ['/my/proj/sdk_ext/entry.dart', '/my/proj/$optionsFileName']));
2144 2140
2145 // Verify filter setup. 2141 // Verify filter setup.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 2200
2205 // Setup analysis options 2201 // Setup analysis options
2206 newFile( 2202 newFile(
2207 [projPath, optionsFileName], 2203 [projPath, optionsFileName],
2208 r''' 2204 r'''
2209 analyzer: 2205 analyzer:
2210 exclude: 2206 exclude:
2211 - 'test/**' 2207 - 'test/**'
2212 language: 2208 language:
2213 enableGenericMethods: true 2209 enableGenericMethods: true
2214 enableAsync: false
2215 errors: 2210 errors:
2216 unused_local_variable: false 2211 unused_local_variable: false
2217 linter: 2212 linter:
2218 rules: 2213 rules:
2219 - camel_case_types 2214 - camel_case_types
2220 '''); 2215 ''');
2221 2216
2222 // Setup context. 2217 // Setup context.
2223 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2218 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2224 await pumpEventQueue(); 2219 await pumpEventQueue();
2225 2220
2226 // Confirm that one context was created. 2221 // Confirm that one context was created.
2227 var contexts = 2222 var contexts =
2228 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 2223 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
2229 expect(contexts, isNotNull); 2224 expect(contexts, isNotNull);
2230 expect(contexts, hasLength(1)); 2225 expect(contexts, hasLength(1));
2231 var context = contexts[0]; 2226 var context = contexts[0];
2232 2227
2233 // Verify options. 2228 // Verify options.
2234 // * from `_embedder.yaml`: 2229 // * from `_embedder.yaml`:
2235 expect(context.analysisOptions.strongMode, isTrue); 2230 expect(context.analysisOptions.strongMode, isTrue);
2236 expect(context.analysisOptions.enableSuperMixins, isTrue); 2231 expect(context.analysisOptions.enableSuperMixins, isTrue);
2237 expect(context.analysisOptions.enableAsync, isFalse);
2238 // * from analysis options: 2232 // * from analysis options:
2239 expect(context.analysisOptions.enableGenericMethods, isTrue); 2233 expect(context.analysisOptions.enableGenericMethods, isTrue);
2240 2234
2241 // * verify tests are excluded 2235 // * verify tests are excluded
2242 expect( 2236 expect(
2243 callbacks.currentContextFilePaths[projPath].keys, 2237 callbacks.currentContextFilePaths[projPath].keys,
2244 unorderedEquals( 2238 unorderedEquals(
2245 ['/my/proj/sdk_ext/entry.dart', '/my/proj/$optionsFileName'])); 2239 ['/my/proj/sdk_ext/entry.dart', '/my/proj/$optionsFileName']));
2246 2240
2247 // Verify filter setup. 2241 // Verify filter setup.
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 class TestUriResolver extends UriResolver { 2714 class TestUriResolver extends UriResolver {
2721 Map<Uri, Source> uriMap; 2715 Map<Uri, Source> uriMap;
2722 2716
2723 TestUriResolver(this.uriMap); 2717 TestUriResolver(this.uriMap);
2724 2718
2725 @override 2719 @override
2726 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2720 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2727 return uriMap[uri]; 2721 return uriMap[uri];
2728 } 2722 }
2729 } 2723 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/status/get_handler.dart ('k') | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698