OLD | NEW |
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/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 136 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
137 expect(manager.isInAnalysisRoot('/test.dart'), isFalse); | 137 expect(manager.isInAnalysisRoot('/test.dart'), isFalse); |
138 } | 138 } |
139 | 139 |
140 test_path_filter() async { | 140 test_path_filter() async { |
141 // Setup context. | 141 // Setup context. |
142 Folder root = resourceProvider.newFolder(projPath); | 142 Folder root = resourceProvider.newFolder(projPath); |
143 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 143 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
144 expect(callbacks.currentContextFilePaths[projPath], isEmpty); | 144 expect(callbacks.currentContextFilePaths[projPath], isEmpty); |
145 // Set ignore patterns for context. | 145 // Set ignore patterns for context. |
| 146 ContextInfo rootInfo = manager.getContextInfoFor(root); |
146 manager.setIgnorePatternsForContext( | 147 manager.setIgnorePatternsForContext( |
147 root, ['sdk_ext/**', 'lib/ignoreme.dart']); | 148 rootInfo, ['sdk_ext/**', 'lib/ignoreme.dart']); |
148 // Start creating files. | 149 // Start creating files. |
149 newFile([projPath, ContextManagerImpl.PUBSPEC_NAME]); | 150 newFile([projPath, ContextManagerImpl.PUBSPEC_NAME]); |
150 String libPath = newFolder([projPath, LIB_NAME]); | 151 String libPath = newFolder([projPath, LIB_NAME]); |
151 newFile([libPath, 'main.dart']); | 152 newFile([libPath, 'main.dart']); |
152 newFile([libPath, 'ignoreme.dart']); | 153 newFile([libPath, 'ignoreme.dart']); |
153 String sdkExtPath = newFolder([projPath, 'sdk_ext']); | 154 String sdkExtPath = newFolder([projPath, 'sdk_ext']); |
154 newFile([sdkExtPath, 'entry.dart']); | 155 newFile([sdkExtPath, 'entry.dart']); |
155 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); | 156 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); |
156 newFile([sdkExtSrcPath, 'part.dart']); | 157 newFile([sdkExtSrcPath, 'part.dart']); |
157 // Pump event loop so new files are discovered and added to context. | 158 // Pump event loop so new files are discovered and added to context. |
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 class TestUriResolver extends UriResolver { | 1562 class TestUriResolver extends UriResolver { |
1562 Map<Uri, Source> uriMap; | 1563 Map<Uri, Source> uriMap; |
1563 | 1564 |
1564 TestUriResolver(this.uriMap); | 1565 TestUriResolver(this.uriMap); |
1565 | 1566 |
1566 @override | 1567 @override |
1567 Source resolveAbsolute(Uri uri) { | 1568 Source resolveAbsolute(Uri uri) { |
1568 return uriMap[uri]; | 1569 return uriMap[uri]; |
1569 } | 1570 } |
1570 } | 1571 } |
OLD | NEW |