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

Side by Side Diff: pkg/analyzer/test/src/dart/sdk/sdk_test.dart

Issue 2209873002: Attempt to fix failures under Windows (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 analyzer.test.generated.sdk_test; 5 library analyzer.test.generated.sdk_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/source/embedder.dart' show EmbedderYamlLocator; 9 import 'package:analyzer/source/embedder.dart' show EmbedderYamlLocator;
10 import 'package:analyzer/src/dart/sdk/sdk.dart'; 10 import 'package:analyzer/src/dart/sdk/sdk.dart';
11 import 'package:analyzer/src/generated/engine.dart'; 11 import 'package:analyzer/src/generated/engine.dart';
12 import 'package:analyzer/src/generated/java_engine_io.dart';
12 import 'package:analyzer/src/generated/sdk.dart'; 13 import 'package:analyzer/src/generated/sdk.dart';
13 import 'package:analyzer/src/generated/source.dart'; 14 import 'package:analyzer/src/generated/source.dart';
14 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
15 16
16 import '../../../generated/test_support.dart'; 17 import '../../../generated/test_support.dart';
17 import '../../../reflective_tests.dart'; 18 import '../../../reflective_tests.dart';
18 import '../../../resource_utils.dart'; 19 import '../../../resource_utils.dart';
19 import '../../../source/embedder_test.dart'; 20 import '../../../source/embedder_test.dart';
20 import '../../../utils.dart'; 21 import '../../../utils.dart';
21 22
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 89 }
89 } 90 }
90 91
91 @reflectiveTest 92 @reflectiveTest
92 class FolderBasedDartSdkTest { 93 class FolderBasedDartSdkTest {
93 /** 94 /**
94 * The resource provider used by these tests. 95 * The resource provider used by these tests.
95 */ 96 */
96 MemoryResourceProvider resourceProvider; 97 MemoryResourceProvider resourceProvider;
97 98
98 // void test_getDocFileFor() {
99 // FolderBasedDartSdk sdk = _createDartSdk();
100 // File docFile = sdk.getDocFileFor("html");
101 // expect(docFile, isNotNull);
102 // }
103
104 void test_analysisOptions_afterContextCreation() { 99 void test_analysisOptions_afterContextCreation() {
105 FolderBasedDartSdk sdk = _createDartSdk(); 100 FolderBasedDartSdk sdk = _createDartSdk();
106 sdk.context; 101 sdk.context;
107 expect(() { 102 expect(() {
108 sdk.analysisOptions = new AnalysisOptionsImpl(); 103 sdk.analysisOptions = new AnalysisOptionsImpl();
109 }, throwsStateError); 104 }, throwsStateError);
110 } 105 }
111 106
112 void test_analysisOptions_beforeContextCreation() { 107 void test_analysisOptions_beforeContextCreation() {
113 FolderBasedDartSdk sdk = _createDartSdk(); 108 FolderBasedDartSdk sdk = _createDartSdk();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 FolderBasedDartSdk sdk = _createDartSdk(); 164 FolderBasedDartSdk sdk = _createDartSdk();
170 Source source = sdk.fromFileUri(sdk.libraryDirectory 165 Source source = sdk.fromFileUri(sdk.libraryDirectory
171 .getChildAssumingFolder("core") 166 .getChildAssumingFolder("core")
172 .getChildAssumingFile("num.dart") 167 .getChildAssumingFile("num.dart")
173 .toUri()); 168 .toUri());
174 expect(source, isNotNull); 169 expect(source, isNotNull);
175 expect(source.isInSystemLibrary, isTrue); 170 expect(source.isInSystemLibrary, isTrue);
176 expect(source.uri.toString(), "dart:core/num.dart"); 171 expect(source.uri.toString(), "dart:core/num.dart");
177 } 172 }
178 173
179 // void test_dart2JsExecutable() {
180 // FolderBasedDartSdk sdk = _createDartSdk();
181 // File executable = sdk.dart2JsExecutable;
182 // expect(executable, isNotNull);
183 // expect(executable.exists, isTrue);
184 //// expect(executable.isExecutable(), isTrue);
185 // }
186
187 void test_getDirectory() { 174 void test_getDirectory() {
188 FolderBasedDartSdk sdk = _createDartSdk(); 175 FolderBasedDartSdk sdk = _createDartSdk();
189 Folder directory = sdk.directory; 176 Folder directory = sdk.directory;
190 expect(directory, isNotNull); 177 expect(directory, isNotNull);
191 expect(directory.exists, isTrue); 178 expect(directory.exists, isTrue);
192 } 179 }
193 180
194 void test_getDocDirectory() { 181 void test_getDocDirectory() {
195 FolderBasedDartSdk sdk = _createDartSdk(); 182 FolderBasedDartSdk sdk = _createDartSdk();
196 Folder directory = sdk.docDirectory; 183 Folder directory = sdk.docDirectory;
197 expect(directory, isNotNull); 184 expect(directory, isNotNull);
198 } 185 }
199 186
200 void test_getLibraryDirectory() { 187 void test_getLibraryDirectory() {
201 FolderBasedDartSdk sdk = _createDartSdk(); 188 FolderBasedDartSdk sdk = _createDartSdk();
202 Folder directory = sdk.libraryDirectory; 189 Folder directory = sdk.libraryDirectory;
203 expect(directory, isNotNull); 190 expect(directory, isNotNull);
204 expect(directory.exists, isTrue); 191 expect(directory.exists, isTrue);
205 } 192 }
206 193
207 void test_getPubExecutable() { 194 void test_getPubExecutable() {
208 FolderBasedDartSdk sdk = _createDartSdk(); 195 FolderBasedDartSdk sdk = _createDartSdk();
209 File executable = sdk.pubExecutable; 196 File executable = sdk.pubExecutable;
210 expect(executable, isNotNull); 197 expect(executable, isNotNull);
211 expect(executable.exists, isTrue); 198 expect(executable.exists, isTrue);
212 // expect(executable.isExecutable(), isTrue);
213 } 199 }
214 200
215 void test_getSdkVersion() { 201 void test_getSdkVersion() {
216 FolderBasedDartSdk sdk = _createDartSdk(); 202 FolderBasedDartSdk sdk = _createDartSdk();
217 String version = sdk.sdkVersion; 203 String version = sdk.sdkVersion;
218 expect(version, isNotNull); 204 expect(version, isNotNull);
219 expect(version.length > 0, isTrue); 205 expect(version.length > 0, isTrue);
220 } 206 }
221 207
222 // void test_vmExecutable() {
223 // FolderBasedDartSdk sdk = _createDartSdk();
224 // File executable = sdk.vmExecutable;
225 // expect(executable, isNotNull);
226 // expect(executable.exists, isTrue);
227 //// expect(executable.isExecutable(), isTrue);
228 // }
229
230 void test_useSummary_afterContextCreation() { 208 void test_useSummary_afterContextCreation() {
231 FolderBasedDartSdk sdk = _createDartSdk(); 209 FolderBasedDartSdk sdk = _createDartSdk();
232 sdk.context; 210 sdk.context;
233 expect(() { 211 expect(() {
234 sdk.useSummary = true; 212 sdk.useSummary = true;
235 }, throwsStateError); 213 }, throwsStateError);
236 } 214 }
237 215
238 void test_useSummary_beforeContextCreation() { 216 void test_useSummary_beforeContextCreation() {
239 FolderBasedDartSdk sdk = _createDartSdk(); 217 FolderBasedDartSdk sdk = _createDartSdk();
240 sdk.useSummary = true; 218 sdk.useSummary = true;
241 sdk.context; 219 sdk.context;
242 } 220 }
243 221
244 FolderBasedDartSdk _createDartSdk() { 222 FolderBasedDartSdk _createDartSdk() {
245 resourceProvider = new MemoryResourceProvider(); 223 resourceProvider = new MemoryResourceProvider();
246 Folder sdkDirectory = resourceProvider.getFolder('/sdk'); 224 Folder sdkDirectory = resourceProvider.getFolder('/sdk');
247 _createFile(sdkDirectory, 225 _createFile(sdkDirectory,
248 ['lib', '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'], 226 ['lib', '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'],
249 content: _librariesFileContent()); 227 content: _librariesFileContent());
250 _createFile(sdkDirectory, ['bin', 'dart']); 228 _createFile(sdkDirectory, ['bin', 'dart']);
251 _createFile(sdkDirectory, ['bin', 'dart2js']); 229 _createFile(sdkDirectory, ['bin', 'dart2js']);
252 _createFile(sdkDirectory, ['bin', 'pub']); 230 _createFile(sdkDirectory, ['bin', 'pub']);
253 _createFile(sdkDirectory, ['lib', 'async', 'async.dart']); 231 _createFile(sdkDirectory, ['lib', 'async', 'async.dart']);
254 _createFile(sdkDirectory, ['lib', 'core', 'core.dart']); 232 _createFile(sdkDirectory, ['lib', 'core', 'core.dart']);
255 _createFile(sdkDirectory, ['lib', 'core', 'num.dart']); 233 _createFile(sdkDirectory, ['lib', 'core', 'num.dart']);
256 _createFile(sdkDirectory, 234 _createFile(sdkDirectory,
257 ['lib', 'html', 'html_common', 'html_common_dart2js.dart']); 235 ['lib', 'html', 'html_common', 'html_common_dart2js.dart']);
258 _createFile(sdkDirectory, ['lib', 'html', 'dartium', 'html_dartium.dart']); 236 _createFile(sdkDirectory, ['lib', 'html', 'dartium', 'html_dartium.dart']);
237 _createFile(
238 sdkDirectory, ['bin', (OSUtilities.isWindows() ? 'pub.bat' : 'pub')]);
259 return new FolderBasedDartSdk(resourceProvider, sdkDirectory); 239 return new FolderBasedDartSdk(resourceProvider, sdkDirectory);
260 } 240 }
261 241
262 void _createFile(Folder directory, List<String> segments, 242 void _createFile(Folder directory, List<String> segments,
263 {String content: ''}) { 243 {String content: ''}) {
264 Folder parent = directory; 244 Folder parent = directory;
265 int last = segments.length - 1; 245 int last = segments.length - 1;
266 for (int i = 0; i < last; i++) { 246 for (int i = 0; i < last; i++) {
267 parent = parent.getChildAssumingFolder(segments[i]); 247 parent = parent.getChildAssumingFolder(segments[i]);
268 } 248 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 expect(second, isNotNull); 358 expect(second, isNotNull);
379 expect(second.category, "Server"); 359 expect(second.category, "Server");
380 expect(second.path, "second/second.dart"); 360 expect(second.path, "second/second.dart");
381 expect(second.shortName, "dart:second"); 361 expect(second.shortName, "dart:second");
382 expect(second.isDart2JsLibrary, false); 362 expect(second.isDart2JsLibrary, false);
383 expect(second.isDocumented, false); 363 expect(second.isDocumented, false);
384 expect(second.isImplementation, true); 364 expect(second.isImplementation, true);
385 expect(second.isVmLibrary, false); 365 expect(second.isVmLibrary, false);
386 } 366 }
387 } 367 }
OLDNEW
« pkg/analyzer/lib/src/dart/sdk/sdk.dart ('K') | « pkg/analyzer/lib/src/dart/sdk/sdk.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698