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/src/context/builder.dart'; | 10 import 'package:analyzer/src/context/builder.dart'; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 String librariesFilePath = pathContext.join(defaultSdkPath, 'lib', | 75 String librariesFilePath = pathContext.join(defaultSdkPath, 'lib', |
76 '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'); | 76 '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'); |
77 resourceProvider.newFile( | 77 resourceProvider.newFile( |
78 librariesFilePath, | 78 librariesFilePath, |
79 r''' | 79 r''' |
80 const Map<String, LibraryInfo> libraries = const { | 80 const Map<String, LibraryInfo> libraries = const { |
81 "async": const LibraryInfo("async/async.dart"), | 81 "async": const LibraryInfo("async/async.dart"), |
82 "core": const LibraryInfo("core/core.dart"), | 82 "core": const LibraryInfo("core/core.dart"), |
83 }; | 83 }; |
84 '''); | 84 '''); |
85 sdkManager = | 85 sdkManager = new DartSdkManager(defaultSdkPath, false); |
86 new DartSdkManager(defaultSdkPath, false, (_) => new MockSdk()); | |
87 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache); | 86 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache); |
88 } | 87 } |
89 | 88 |
90 void createFile(String path, String content) { | 89 void createFile(String path, String content) { |
91 resourceProvider.newFile(path, content); | 90 resourceProvider.newFile(path, content); |
92 } | 91 } |
93 | 92 |
94 @override | 93 @override |
95 void setUp() { | 94 void setUp() { |
96 resourceProvider = new MemoryResourceProvider(); | 95 resourceProvider = new MemoryResourceProvider(); |
97 pathContext = resourceProvider.pathContext; | 96 pathContext = resourceProvider.pathContext; |
98 new MockSdk(resourceProvider: resourceProvider); | 97 new MockSdk(resourceProvider: resourceProvider); |
99 sdkManager = | 98 sdkManager = |
100 new DartSdkManager(resourceProvider.convertPath('/sdk'), false, (_) { | 99 new DartSdkManager(resourceProvider.convertPath('/sdk'), false); |
101 fail('Should not be used to create an SDK'); | |
102 }); | |
103 contentCache = new ContentCache(); | 100 contentCache = new ContentCache(); |
104 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache); | 101 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache); |
105 } | 102 } |
106 | 103 |
107 @failingTest | 104 @failingTest |
108 void test_buildContext() { | 105 void test_buildContext() { |
109 fail('Incomplete test'); | 106 fail('Incomplete test'); |
110 } | 107 } |
111 | 108 |
112 void test_convertPackagesToMap_noPackages() { | 109 void test_convertPackagesToMap_noPackages() { |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 fail('Unexpected invocation of optionsProcessed'); | 736 fail('Unexpected invocation of optionsProcessed'); |
740 } | 737 } |
741 expect(options, hasLength(expectedOptions.length)); | 738 expect(options, hasLength(expectedOptions.length)); |
742 for (String key in expectedOptions.keys) { | 739 for (String key in expectedOptions.keys) { |
743 expect(options.containsKey(key), isTrue, reason: 'missing key $key'); | 740 expect(options.containsKey(key), isTrue, reason: 'missing key $key'); |
744 expect(options[key], expectedOptions[key], | 741 expect(options[key], expectedOptions[key], |
745 reason: 'values for key $key do not match'); | 742 reason: 'values for key $key do not match'); |
746 } | 743 } |
747 } | 744 } |
748 } | 745 } |
OLD | NEW |