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 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/src/context/builder.dart' show EmbedderYamlLocator; | 9 import 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator; |
10 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 10 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 339 } |
340 | 340 |
341 @reflectiveTest | 341 @reflectiveTest |
342 class SdkExtensionFinderTest { | 342 class SdkExtensionFinderTest { |
343 MemoryResourceProvider resourceProvider; | 343 MemoryResourceProvider resourceProvider; |
344 | 344 |
345 void setUp() { | 345 void setUp() { |
346 resourceProvider = new MemoryResourceProvider(); | 346 resourceProvider = new MemoryResourceProvider(); |
347 resourceProvider.newFolder(resourceProvider.convertPath('/empty')); | 347 resourceProvider.newFolder(resourceProvider.convertPath('/empty')); |
348 resourceProvider.newFolder(resourceProvider.convertPath('/tmp')); | 348 resourceProvider.newFolder(resourceProvider.convertPath('/tmp')); |
349 resourceProvider.newFile( | 349 resourceProvider.newFile(resourceProvider.convertPath('/tmp/_sdkext'), r''' |
350 resourceProvider.convertPath('/tmp/_sdkext'), | |
351 r''' | |
352 { | 350 { |
353 "dart:fox": "slippy.dart", | 351 "dart:fox": "slippy.dart", |
354 "dart:bear": "grizzly.dart", | 352 "dart:bear": "grizzly.dart", |
355 "dart:relative": "../relative.dart", | 353 "dart:relative": "../relative.dart", |
356 "dart:deep": "deep/directory/file.dart", | 354 "dart:deep": "deep/directory/file.dart", |
357 "fart:loudly": "nomatter.dart" | 355 "fart:loudly": "nomatter.dart" |
358 }'''); | 356 }'''); |
359 } | 357 } |
360 | 358 |
361 test_create_noSdkExtPackageMap() { | 359 test_create_noSdkExtPackageMap() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 * The resource provider used by these tests. | 397 * The resource provider used by these tests. |
400 */ | 398 */ |
401 MemoryResourceProvider resourceProvider; | 399 MemoryResourceProvider resourceProvider; |
402 | 400 |
403 @override | 401 @override |
404 void setUp() { | 402 void setUp() { |
405 resourceProvider = new MemoryResourceProvider(); | 403 resourceProvider = new MemoryResourceProvider(); |
406 } | 404 } |
407 | 405 |
408 void test_readFrom_dart2js() { | 406 void test_readFrom_dart2js() { |
409 LibraryMap libraryMap = new SdkLibrariesReader(true).readFromFile( | 407 LibraryMap libraryMap = new SdkLibrariesReader(true) |
410 resourceProvider.getFile("/libs.dart"), | 408 .readFromFile(resourceProvider.getFile("/libs.dart"), r''' |
411 r''' | |
412 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { | 409 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
413 'first' : const LibraryInfo( | 410 'first' : const LibraryInfo( |
414 'first/first.dart', | 411 'first/first.dart', |
415 categories: 'Client', | 412 categories: 'Client', |
416 documented: true, | 413 documented: true, |
417 platforms: VM_PLATFORM, | 414 platforms: VM_PLATFORM, |
418 dart2jsPath: 'first/first_dart2js.dart'), | 415 dart2jsPath: 'first/first_dart2js.dart'), |
419 };'''); | 416 };'''); |
420 expect(libraryMap, isNotNull); | 417 expect(libraryMap, isNotNull); |
421 expect(libraryMap.size(), 1); | 418 expect(libraryMap.size(), 1); |
422 SdkLibrary first = libraryMap.getLibrary("dart:first"); | 419 SdkLibrary first = libraryMap.getLibrary("dart:first"); |
423 expect(first, isNotNull); | 420 expect(first, isNotNull); |
424 expect(first.category, "Client"); | 421 expect(first.category, "Client"); |
425 expect(first.path, "first/first_dart2js.dart"); | 422 expect(first.path, "first/first_dart2js.dart"); |
426 expect(first.shortName, "dart:first"); | 423 expect(first.shortName, "dart:first"); |
427 expect(first.isDart2JsLibrary, false); | 424 expect(first.isDart2JsLibrary, false); |
428 expect(first.isDocumented, true); | 425 expect(first.isDocumented, true); |
429 expect(first.isImplementation, false); | 426 expect(first.isImplementation, false); |
430 expect(first.isVmLibrary, true); | 427 expect(first.isVmLibrary, true); |
431 } | 428 } |
432 | 429 |
433 void test_readFrom_empty() { | 430 void test_readFrom_empty() { |
434 LibraryMap libraryMap = new SdkLibrariesReader(false) | 431 LibraryMap libraryMap = new SdkLibrariesReader(false) |
435 .readFromFile(resourceProvider.getFile("/libs.dart"), ""); | 432 .readFromFile(resourceProvider.getFile("/libs.dart"), ""); |
436 expect(libraryMap, isNotNull); | 433 expect(libraryMap, isNotNull); |
437 expect(libraryMap.size(), 0); | 434 expect(libraryMap.size(), 0); |
438 } | 435 } |
439 | 436 |
440 void test_readFrom_normal() { | 437 void test_readFrom_normal() { |
441 LibraryMap libraryMap = new SdkLibrariesReader(false).readFromFile( | 438 LibraryMap libraryMap = new SdkLibrariesReader(false) |
442 resourceProvider.getFile("/libs.dart"), | 439 .readFromFile(resourceProvider.getFile("/libs.dart"), r''' |
443 r''' | |
444 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { | 440 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
445 'first' : const LibraryInfo( | 441 'first' : const LibraryInfo( |
446 'first/first.dart', | 442 'first/first.dart', |
447 categories: 'Client', | 443 categories: 'Client', |
448 documented: true, | 444 documented: true, |
449 platforms: VM_PLATFORM), | 445 platforms: VM_PLATFORM), |
450 | 446 |
451 'second' : const LibraryInfo( | 447 'second' : const LibraryInfo( |
452 'second/second.dart', | 448 'second/second.dart', |
453 categories: 'Server', | 449 categories: 'Server', |
(...skipping 16 matching lines...) Expand all Loading... |
470 expect(second, isNotNull); | 466 expect(second, isNotNull); |
471 expect(second.category, "Server"); | 467 expect(second.category, "Server"); |
472 expect(second.path, "second/second.dart"); | 468 expect(second.path, "second/second.dart"); |
473 expect(second.shortName, "dart:second"); | 469 expect(second.shortName, "dart:second"); |
474 expect(second.isDart2JsLibrary, false); | 470 expect(second.isDart2JsLibrary, false); |
475 expect(second.isDocumented, false); | 471 expect(second.isDocumented, false); |
476 expect(second.isImplementation, true); | 472 expect(second.isImplementation, true); |
477 expect(second.isVmLibrary, false); | 473 expect(second.isVmLibrary, false); |
478 } | 474 } |
479 } | 475 } |
OLD | NEW |