| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.test.src.context.context_builder_test; | 5 library analyzer.test.src.context.context_builder_test; |
| 6 | 6 |
| 7 import 'package:analyzer/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
| 8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 9 import 'package:analyzer/plugin/options.dart'; | 9 import 'package:analyzer/plugin/options.dart'; |
| 10 import 'package:analyzer/source/package_map_resolver.dart'; | 10 import 'package:analyzer/source/package_map_resolver.dart'; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 void createFile(String path, String content) { | 90 void createFile(String path, String content) { |
| 91 resourceProvider.newFile(path, content); | 91 resourceProvider.newFile(path, content); |
| 92 } | 92 } |
| 93 | 93 |
| 94 @override | 94 @override |
| 95 void setUp() { | 95 void setUp() { |
| 96 resourceProvider = new MemoryResourceProvider(); | 96 resourceProvider = new MemoryResourceProvider(); |
| 97 pathContext = resourceProvider.pathContext; | 97 pathContext = resourceProvider.pathContext; |
| 98 new MockSdk(resourceProvider: resourceProvider); | 98 new MockSdk(resourceProvider: resourceProvider); |
| 99 sdkManager = new DartSdkManager('/', false, (_) { | 99 sdkManager = new DartSdkManager('/sdk', false, (_) { |
| 100 fail('Should not be used to create an SDK'); | 100 fail('Should not be used to create an SDK'); |
| 101 }); | 101 }); |
| 102 contentCache = new ContentCache(); | 102 contentCache = new ContentCache(); |
| 103 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache); | 103 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache); |
| 104 } | 104 } |
| 105 | 105 |
| 106 @failingTest | 106 @failingTest |
| 107 void test_buildContext() { | 107 void test_buildContext() { |
| 108 fail('Incomplete test'); | 108 fail('Incomplete test'); |
| 109 } | 109 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 void test_findSdk_noEmbedder_noExtensions() { | 477 void test_findSdk_noEmbedder_noExtensions() { |
| 478 // See test_createSourceFactory_noProvider_packages_noEmbedder_noExtensions | 478 // See test_createSourceFactory_noProvider_packages_noEmbedder_noExtensions |
| 479 fail('Incomplete test'); | 479 fail('Incomplete test'); |
| 480 } | 480 } |
| 481 | 481 |
| 482 void test_findSdk_noPackageMap() { | 482 void test_findSdk_noPackageMap() { |
| 483 DartSdk sdk = builder.findSdk(null, new AnalysisOptionsImpl()); | 483 DartSdk sdk = builder.findSdk(null, new AnalysisOptionsImpl()); |
| 484 expect(sdk, isNotNull); | 484 expect(sdk, isNotNull); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void test_findSdk_noPackageMap_html_spec() { |
| 488 DartSdk sdk = builder.findSdk(null, new AnalysisOptionsImpl()); |
| 489 expect(sdk, isNotNull); |
| 490 Source htmlSource = sdk.mapDartUri('dart:html'); |
| 491 expect( |
| 492 htmlSource.fullName, |
| 493 resourceProvider |
| 494 .convertPath('/sdk/lib/html/dartium/html_dartium.dart')); |
| 495 expect(htmlSource.exists(), isTrue); |
| 496 } |
| 497 |
| 498 void test_findSdk_noPackageMap_html_strong() { |
| 499 DartSdk sdk = |
| 500 builder.findSdk(null, new AnalysisOptionsImpl()..strongMode = true); |
| 501 expect(sdk, isNotNull); |
| 502 Source htmlSource = sdk.mapDartUri('dart:html'); |
| 503 expect( |
| 504 htmlSource.fullName, |
| 505 resourceProvider |
| 506 .convertPath('/sdk/lib/html/dart2js/html_dart2js.dart')); |
| 507 expect(htmlSource.exists(), isTrue); |
| 508 } |
| 509 |
| 487 void test_getAnalysisOptions_default_noOverrides() { | 510 void test_getAnalysisOptions_default_noOverrides() { |
| 488 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); | 511 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); |
| 489 defaultOptions.enableGenericMethods = true; | 512 defaultOptions.enableGenericMethods = true; |
| 490 builder.defaultOptions = defaultOptions; | 513 builder.defaultOptions = defaultOptions; |
| 491 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); | 514 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); |
| 492 expected.enableGenericMethods = true; | 515 expected.enableGenericMethods = true; |
| 493 String path = resourceProvider.convertPath('/some/directory/path'); | 516 String path = resourceProvider.convertPath('/some/directory/path'); |
| 494 String filePath = | 517 String filePath = |
| 495 pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); | 518 pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); |
| 496 resourceProvider.newFile( | 519 resourceProvider.newFile( |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 fail('Unexpected invocation of optionsProcessed'); | 755 fail('Unexpected invocation of optionsProcessed'); |
| 733 } | 756 } |
| 734 expect(options, hasLength(expectedOptions.length)); | 757 expect(options, hasLength(expectedOptions.length)); |
| 735 for (String key in expectedOptions.keys) { | 758 for (String key in expectedOptions.keys) { |
| 736 expect(options.containsKey(key), isTrue, reason: 'missing key $key'); | 759 expect(options.containsKey(key), isTrue, reason: 'missing key $key'); |
| 737 expect(options[key], expectedOptions[key], | 760 expect(options[key], expectedOptions[key], |
| 738 reason: 'values for key $key do not match'); | 761 reason: 'values for key $key do not match'); |
| 739 } | 762 } |
| 740 } | 763 } |
| 741 } | 764 } |
| OLD | NEW |