| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 callbacks = new TestContextManagerCallbacks(resourceProvider); | 140 callbacks = new TestContextManagerCallbacks(resourceProvider); |
| 141 manager.callbacks = callbacks; | 141 manager.callbacks = callbacks; |
| 142 resourceProvider.newFolder(projPath); | 142 resourceProvider.newFolder(projPath); |
| 143 } | 143 } |
| 144 | 144 |
| 145 test_analysis_options_file_delete() async { | 145 test_analysis_options_file_delete() async { |
| 146 // Setup .analysis_options | 146 // Setup .analysis_options |
| 147 newFile( | 147 newFile( |
| 148 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], | 148 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], |
| 149 r''' | 149 r''' |
| 150 embedder_libs: | 150 embedded_libs: |
| 151 "dart:foobar": "../sdk_ext/entry.dart" | 151 "dart:foobar": "../sdk_ext/entry.dart" |
| 152 analyzer: | 152 analyzer: |
| 153 language: | 153 language: |
| 154 enableGenericMethods: true | 154 enableGenericMethods: true |
| 155 errors: | 155 errors: |
| 156 unused_local_variable: false | 156 unused_local_variable: false |
| 157 linter: | 157 linter: |
| 158 rules: | 158 rules: |
| 159 - camel_case_types | 159 - camel_case_types |
| 160 '''); | 160 '''); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 test_embedder_options() async { | 283 test_embedder_options() async { |
| 284 // Create files. | 284 // Create files. |
| 285 String libPath = newFolder([projPath, LIB_NAME]); | 285 String libPath = newFolder([projPath, LIB_NAME]); |
| 286 String sdkExtPath = newFolder([projPath, 'sdk_ext']); | 286 String sdkExtPath = newFolder([projPath, 'sdk_ext']); |
| 287 newFile([projPath, 'test', 'test.dart']); | 287 newFile([projPath, 'test', 'test.dart']); |
| 288 newFile([sdkExtPath, 'entry.dart']); | 288 newFile([sdkExtPath, 'entry.dart']); |
| 289 // Setup _embedder.yaml. | 289 // Setup _embedder.yaml. |
| 290 newFile( | 290 newFile( |
| 291 [libPath, '_embedder.yaml'], | 291 [libPath, '_embedder.yaml'], |
| 292 r''' | 292 r''' |
| 293 embedder_libs: | 293 embedded_libs: |
| 294 "dart:foobar": "../sdk_ext/entry.dart" | 294 "dart:foobar": "../sdk_ext/entry.dart" |
| 295 analyzer: | 295 analyzer: |
| 296 strong-mode: true | 296 strong-mode: true |
| 297 language: | 297 language: |
| 298 enableSuperMixins: true | 298 enableSuperMixins: true |
| 299 errors: | 299 errors: |
| 300 missing_return: false | 300 missing_return: false |
| 301 linter: | 301 linter: |
| 302 rules: | 302 rules: |
| 303 - avoid_as | 303 - avoid_as |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 newFile([libPath, 'main.dart']); | 377 newFile([libPath, 'main.dart']); |
| 378 newFile([libPath, 'nope.dart']); | 378 newFile([libPath, 'nope.dart']); |
| 379 String sdkExtPath = newFolder([projPath, 'sdk_ext']); | 379 String sdkExtPath = newFolder([projPath, 'sdk_ext']); |
| 380 newFile([sdkExtPath, 'entry.dart']); | 380 newFile([sdkExtPath, 'entry.dart']); |
| 381 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); | 381 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); |
| 382 newFile([sdkExtSrcPath, 'part.dart']); | 382 newFile([sdkExtSrcPath, 'part.dart']); |
| 383 // Setup _embedder.yaml. | 383 // Setup _embedder.yaml. |
| 384 newFile( | 384 newFile( |
| 385 [libPath, '_embedder.yaml'], | 385 [libPath, '_embedder.yaml'], |
| 386 r''' | 386 r''' |
| 387 embedder_libs: | 387 embedded_libs: |
| 388 "dart:foobar": "../sdk_ext/entry.dart" | 388 "dart:foobar": "../sdk_ext/entry.dart" |
| 389 "dart:typed_data": "../sdk_ext/src/part" | 389 "dart:typed_data": "../sdk_ext/src/part" |
| 390 '''); | 390 '''); |
| 391 // Setup .packages file | 391 // Setup .packages file |
| 392 newFile( | 392 newFile( |
| 393 [projPath, '.packages'], | 393 [projPath, '.packages'], |
| 394 r''' | 394 r''' |
| 395 test_pack:lib/'''); | 395 test_pack:lib/'''); |
| 396 // Setup context. | 396 // Setup context. |
| 397 | 397 |
| 398 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 398 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
| 399 await pumpEventQueue(); | 399 await pumpEventQueue(); |
| 400 // Confirm that one context was created. | 400 // Confirm that one context was created. |
| 401 var contexts = | 401 var contexts = |
| 402 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); | 402 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); |
| 403 expect(contexts, isNotNull); | 403 expect(contexts, isNotNull); |
| 404 expect(contexts.length, equals(1)); | 404 expect(contexts.length, equals(1)); |
| 405 var context = contexts[0]; | 405 var context = contexts[0]; |
| 406 var source = context.sourceFactory.forUri('dart:foobar'); | 406 var source = context.sourceFactory.forUri('dart:foobar'); |
| 407 expect(source, isNotNull); | 407 expect(source, isNotNull); |
| 408 expect(source.fullName, | 408 expect(source.fullName, |
| 409 '/my/proj/sdk_ext/entry.dart'.replaceAll('/', JavaFile.separator)); | 409 '/my/proj/sdk_ext/entry.dart'.replaceAll('/', JavaFile.separator)); |
| 410 // We can't find dart:core because we didn't list it in our | 410 // We can't find dart:core because we didn't list it in our |
| 411 // embedder_libs map. | 411 // embedded_libs map. |
| 412 expect(context.sourceFactory.forUri('dart:core'), isNull); | 412 expect(context.sourceFactory.forUri('dart:core'), isNull); |
| 413 // We can find dart:typed_data because we listed it in our | 413 // We can find dart:typed_data because we listed it in our |
| 414 // embedder_libs map. | 414 // embedded_libs map. |
| 415 expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull); | 415 expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull); |
| 416 } | 416 } |
| 417 | 417 |
| 418 test_error_filter_analysis_option() async { | 418 test_error_filter_analysis_option() async { |
| 419 // Create files. | 419 // Create files. |
| 420 newFile( | 420 newFile( |
| 421 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], | 421 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], |
| 422 r''' | 422 r''' |
| 423 analyzer: | 423 analyzer: |
| 424 errors: | 424 errors: |
| (...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 class TestUriResolver extends UriResolver { | 2421 class TestUriResolver extends UriResolver { |
| 2422 Map<Uri, Source> uriMap; | 2422 Map<Uri, Source> uriMap; |
| 2423 | 2423 |
| 2424 TestUriResolver(this.uriMap); | 2424 TestUriResolver(this.uriMap); |
| 2425 | 2425 |
| 2426 @override | 2426 @override |
| 2427 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 2427 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 2428 return uriMap[uri]; | 2428 return uriMap[uri]; |
| 2429 } | 2429 } |
| 2430 } | 2430 } |
| OLD | NEW |