| 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.all_the_rest_test; | 5 library analyzer.test.generated.all_the_rest_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 | 360 |
| 361 @override | 361 @override |
| 362 void reset() { | 362 void reset() { |
| 363 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl(); | 363 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl(); |
| 364 analysisOptions.hint = false; | 364 analysisOptions.hint = false; |
| 365 resetWith(options: analysisOptions); | 365 resetWith(options: analysisOptions); |
| 366 } | 366 } |
| 367 | 367 |
| 368 test_locate_AssignmentExpression() async { | 368 test_locate_AssignmentExpression() async { |
| 369 AstNode id = await _findNodeIn( | 369 AstNode id = await _findNodeIn("+=", r''' |
| 370 "+=", | |
| 371 r''' | |
| 372 int x = 0; | 370 int x = 0; |
| 373 void main() { | 371 void main() { |
| 374 x += 1; | 372 x += 1; |
| 375 }'''); | 373 }'''); |
| 376 Element element = ElementLocator.locate(id); | 374 Element element = ElementLocator.locate(id); |
| 377 EngineTestCase.assertInstanceOf( | 375 EngineTestCase.assertInstanceOf( |
| 378 (obj) => obj is MethodElement, MethodElement, element); | 376 (obj) => obj is MethodElement, MethodElement, element); |
| 379 } | 377 } |
| 380 | 378 |
| 381 test_locate_BinaryExpression() async { | 379 test_locate_BinaryExpression() async { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 393 } | 391 } |
| 394 | 392 |
| 395 test_locate_CompilationUnit() async { | 393 test_locate_CompilationUnit() async { |
| 396 CompilationUnit cu = await _resolveContents("// only comment"); | 394 CompilationUnit cu = await _resolveContents("// only comment"); |
| 397 expect(cu.element, isNotNull); | 395 expect(cu.element, isNotNull); |
| 398 Element element = ElementLocator.locate(cu); | 396 Element element = ElementLocator.locate(cu); |
| 399 expect(element, same(cu.element)); | 397 expect(element, same(cu.element)); |
| 400 } | 398 } |
| 401 | 399 |
| 402 test_locate_ConstructorDeclaration() async { | 400 test_locate_ConstructorDeclaration() async { |
| 403 AstNode id = await _findNodeIndexedIn( | 401 AstNode id = await _findNodeIndexedIn("bar", 0, r''' |
| 404 "bar", | |
| 405 0, | |
| 406 r''' | |
| 407 class A { | 402 class A { |
| 408 A.bar() {} | 403 A.bar() {} |
| 409 }'''); | 404 }'''); |
| 410 ConstructorDeclaration declaration = | 405 ConstructorDeclaration declaration = |
| 411 id.getAncestor((node) => node is ConstructorDeclaration); | 406 id.getAncestor((node) => node is ConstructorDeclaration); |
| 412 Element element = ElementLocator.locate(declaration); | 407 Element element = ElementLocator.locate(declaration); |
| 413 EngineTestCase.assertInstanceOf( | 408 EngineTestCase.assertInstanceOf( |
| 414 (obj) => obj is ConstructorElement, ConstructorElement, element); | 409 (obj) => obj is ConstructorElement, ConstructorElement, element); |
| 415 } | 410 } |
| 416 | 411 |
| 417 test_locate_ExportDirective() async { | 412 test_locate_ExportDirective() async { |
| 418 AstNode id = await _findNodeIn("export", "export 'dart:core';"); | 413 AstNode id = await _findNodeIn("export", "export 'dart:core';"); |
| 419 Element element = ElementLocator.locate(id); | 414 Element element = ElementLocator.locate(id); |
| 420 EngineTestCase.assertInstanceOf( | 415 EngineTestCase.assertInstanceOf( |
| 421 (obj) => obj is ExportElement, ExportElement, element); | 416 (obj) => obj is ExportElement, ExportElement, element); |
| 422 } | 417 } |
| 423 | 418 |
| 424 test_locate_FunctionDeclaration() async { | 419 test_locate_FunctionDeclaration() async { |
| 425 AstNode id = await _findNodeIn("f", "int f() => 3;"); | 420 AstNode id = await _findNodeIn("f", "int f() => 3;"); |
| 426 FunctionDeclaration declaration = | 421 FunctionDeclaration declaration = |
| 427 id.getAncestor((node) => node is FunctionDeclaration); | 422 id.getAncestor((node) => node is FunctionDeclaration); |
| 428 Element element = ElementLocator.locate(declaration); | 423 Element element = ElementLocator.locate(declaration); |
| 429 EngineTestCase.assertInstanceOf( | 424 EngineTestCase.assertInstanceOf( |
| 430 (obj) => obj is FunctionElement, FunctionElement, element); | 425 (obj) => obj is FunctionElement, FunctionElement, element); |
| 431 } | 426 } |
| 432 | 427 |
| 433 test_locate_Identifier_annotationClass_namedConstructor_forSimpleFormalParamet
er() async { | 428 test_locate_Identifier_annotationClass_namedConstructor_forSimpleFormalParamet
er() async { |
| 434 AstNode id = await _findNodeIndexedIn( | 429 AstNode id = await _findNodeIndexedIn("Class", 2, r''' |
| 435 "Class", | |
| 436 2, | |
| 437 r''' | |
| 438 class Class { | 430 class Class { |
| 439 const Class.name(); | 431 const Class.name(); |
| 440 } | 432 } |
| 441 void main(@Class.name() parameter) { | 433 void main(@Class.name() parameter) { |
| 442 }'''); | 434 }'''); |
| 443 Element element = ElementLocator.locate(id); | 435 Element element = ElementLocator.locate(id); |
| 444 EngineTestCase.assertInstanceOf( | 436 EngineTestCase.assertInstanceOf( |
| 445 (obj) => obj is ClassElement, ClassElement, element); | 437 (obj) => obj is ClassElement, ClassElement, element); |
| 446 } | 438 } |
| 447 | 439 |
| 448 test_locate_Identifier_annotationClass_unnamedConstructor_forSimpleFormalParam
eter() async { | 440 test_locate_Identifier_annotationClass_unnamedConstructor_forSimpleFormalParam
eter() async { |
| 449 AstNode id = await _findNodeIndexedIn( | 441 AstNode id = await _findNodeIndexedIn("Class", 2, r''' |
| 450 "Class", | |
| 451 2, | |
| 452 r''' | |
| 453 class Class { | 442 class Class { |
| 454 const Class(); | 443 const Class(); |
| 455 } | 444 } |
| 456 void main(@Class() parameter) { | 445 void main(@Class() parameter) { |
| 457 }'''); | 446 }'''); |
| 458 Element element = ElementLocator.locate(id); | 447 Element element = ElementLocator.locate(id); |
| 459 EngineTestCase.assertInstanceOf( | 448 EngineTestCase.assertInstanceOf( |
| 460 (obj) => obj is ConstructorElement, ConstructorElement, element); | 449 (obj) => obj is ConstructorElement, ConstructorElement, element); |
| 461 } | 450 } |
| 462 | 451 |
| 463 test_locate_Identifier_className() async { | 452 test_locate_Identifier_className() async { |
| 464 AstNode id = await _findNodeIn("A", "class A { }"); | 453 AstNode id = await _findNodeIn("A", "class A { }"); |
| 465 Element element = ElementLocator.locate(id); | 454 Element element = ElementLocator.locate(id); |
| 466 EngineTestCase.assertInstanceOf( | 455 EngineTestCase.assertInstanceOf( |
| 467 (obj) => obj is ClassElement, ClassElement, element); | 456 (obj) => obj is ClassElement, ClassElement, element); |
| 468 } | 457 } |
| 469 | 458 |
| 470 test_locate_Identifier_constructor_named() async { | 459 test_locate_Identifier_constructor_named() async { |
| 471 AstNode id = await _findNodeIndexedIn( | 460 AstNode id = await _findNodeIndexedIn("bar", 0, r''' |
| 472 "bar", | |
| 473 0, | |
| 474 r''' | |
| 475 class A { | 461 class A { |
| 476 A.bar() {} | 462 A.bar() {} |
| 477 }'''); | 463 }'''); |
| 478 Element element = ElementLocator.locate(id); | 464 Element element = ElementLocator.locate(id); |
| 479 EngineTestCase.assertInstanceOf( | 465 EngineTestCase.assertInstanceOf( |
| 480 (obj) => obj is ConstructorElement, ConstructorElement, element); | 466 (obj) => obj is ConstructorElement, ConstructorElement, element); |
| 481 } | 467 } |
| 482 | 468 |
| 483 test_locate_Identifier_constructor_unnamed() async { | 469 test_locate_Identifier_constructor_unnamed() async { |
| 484 AstNode id = await _findNodeIndexedIn( | 470 AstNode id = await _findNodeIndexedIn("A", 1, r''' |
| 485 "A", | |
| 486 1, | |
| 487 r''' | |
| 488 class A { | 471 class A { |
| 489 A() {} | 472 A() {} |
| 490 }'''); | 473 }'''); |
| 491 Element element = ElementLocator.locate(id); | 474 Element element = ElementLocator.locate(id); |
| 492 EngineTestCase.assertInstanceOf( | 475 EngineTestCase.assertInstanceOf( |
| 493 (obj) => obj is ConstructorElement, ConstructorElement, element); | 476 (obj) => obj is ConstructorElement, ConstructorElement, element); |
| 494 } | 477 } |
| 495 | 478 |
| 496 test_locate_Identifier_fieldName() async { | 479 test_locate_Identifier_fieldName() async { |
| 497 AstNode id = await _findNodeIn("x", "class A { var x; }"); | 480 AstNode id = await _findNodeIn("x", "class A { var x; }"); |
| 498 Element element = ElementLocator.locate(id); | 481 Element element = ElementLocator.locate(id); |
| 499 EngineTestCase.assertInstanceOf( | 482 EngineTestCase.assertInstanceOf( |
| 500 (obj) => obj is FieldElement, FieldElement, element); | 483 (obj) => obj is FieldElement, FieldElement, element); |
| 501 } | 484 } |
| 502 | 485 |
| 503 test_locate_Identifier_libraryDirective() async { | 486 test_locate_Identifier_libraryDirective() async { |
| 504 AstNode id = await _findNodeIn("foo", "library foo.bar;"); | 487 AstNode id = await _findNodeIn("foo", "library foo.bar;"); |
| 505 Element element = ElementLocator.locate(id); | 488 Element element = ElementLocator.locate(id); |
| 506 EngineTestCase.assertInstanceOf( | 489 EngineTestCase.assertInstanceOf( |
| 507 (obj) => obj is LibraryElement, LibraryElement, element); | 490 (obj) => obj is LibraryElement, LibraryElement, element); |
| 508 } | 491 } |
| 509 | 492 |
| 510 test_locate_Identifier_propertyAccess() async { | 493 test_locate_Identifier_propertyAccess() async { |
| 511 AstNode id = await _findNodeIn( | 494 AstNode id = await _findNodeIn("length", r''' |
| 512 "length", | |
| 513 r''' | |
| 514 void main() { | 495 void main() { |
| 515 int x = 'foo'.length; | 496 int x = 'foo'.length; |
| 516 }'''); | 497 }'''); |
| 517 Element element = ElementLocator.locate(id); | 498 Element element = ElementLocator.locate(id); |
| 518 EngineTestCase.assertInstanceOf((obj) => obj is PropertyAccessorElement, | 499 EngineTestCase.assertInstanceOf((obj) => obj is PropertyAccessorElement, |
| 519 PropertyAccessorElement, element); | 500 PropertyAccessorElement, element); |
| 520 } | 501 } |
| 521 | 502 |
| 522 test_locate_ImportDirective() async { | 503 test_locate_ImportDirective() async { |
| 523 AstNode id = await _findNodeIn("import", "import 'dart:core';"); | 504 AstNode id = await _findNodeIn("import", "import 'dart:core';"); |
| 524 Element element = ElementLocator.locate(id); | 505 Element element = ElementLocator.locate(id); |
| 525 EngineTestCase.assertInstanceOf( | 506 EngineTestCase.assertInstanceOf( |
| 526 (obj) => obj is ImportElement, ImportElement, element); | 507 (obj) => obj is ImportElement, ImportElement, element); |
| 527 } | 508 } |
| 528 | 509 |
| 529 test_locate_IndexExpression() async { | 510 test_locate_IndexExpression() async { |
| 530 AstNode id = await _findNodeIndexedIn( | 511 AstNode id = await _findNodeIndexedIn("\\[", 1, r''' |
| 531 "\\[", | |
| 532 1, | |
| 533 r''' | |
| 534 void main() { | 512 void main() { |
| 535 List x = [1, 2]; | 513 List x = [1, 2]; |
| 536 var y = x[0]; | 514 var y = x[0]; |
| 537 }'''); | 515 }'''); |
| 538 Element element = ElementLocator.locate(id); | 516 Element element = ElementLocator.locate(id); |
| 539 EngineTestCase.assertInstanceOf( | 517 EngineTestCase.assertInstanceOf( |
| 540 (obj) => obj is MethodElement, MethodElement, element); | 518 (obj) => obj is MethodElement, MethodElement, element); |
| 541 } | 519 } |
| 542 | 520 |
| 543 test_locate_InstanceCreationExpression() async { | 521 test_locate_InstanceCreationExpression() async { |
| 544 AstNode node = await _findNodeIndexedIn( | 522 AstNode node = await _findNodeIndexedIn("A(", 0, r''' |
| 545 "A(", | |
| 546 0, | |
| 547 r''' | |
| 548 class A {} | 523 class A {} |
| 549 void main() { | 524 void main() { |
| 550 new A(); | 525 new A(); |
| 551 }'''); | 526 }'''); |
| 552 Element element = ElementLocator.locate(node); | 527 Element element = ElementLocator.locate(node); |
| 553 EngineTestCase.assertInstanceOf( | 528 EngineTestCase.assertInstanceOf( |
| 554 (obj) => obj is ConstructorElement, ConstructorElement, element); | 529 (obj) => obj is ConstructorElement, ConstructorElement, element); |
| 555 } | 530 } |
| 556 | 531 |
| 557 test_locate_InstanceCreationExpression_type_prefixedIdentifier() async { | 532 test_locate_InstanceCreationExpression_type_prefixedIdentifier() async { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 } | 568 } |
| 594 | 569 |
| 595 test_locate_LibraryDirective() async { | 570 test_locate_LibraryDirective() async { |
| 596 AstNode id = await _findNodeIn("library", "library foo;"); | 571 AstNode id = await _findNodeIn("library", "library foo;"); |
| 597 Element element = ElementLocator.locate(id); | 572 Element element = ElementLocator.locate(id); |
| 598 EngineTestCase.assertInstanceOf( | 573 EngineTestCase.assertInstanceOf( |
| 599 (obj) => obj is LibraryElement, LibraryElement, element); | 574 (obj) => obj is LibraryElement, LibraryElement, element); |
| 600 } | 575 } |
| 601 | 576 |
| 602 test_locate_MethodDeclaration() async { | 577 test_locate_MethodDeclaration() async { |
| 603 AstNode id = await _findNodeIn( | 578 AstNode id = await _findNodeIn("m", r''' |
| 604 "m", | |
| 605 r''' | |
| 606 class A { | 579 class A { |
| 607 void m() {} | 580 void m() {} |
| 608 }'''); | 581 }'''); |
| 609 MethodDeclaration declaration = | 582 MethodDeclaration declaration = |
| 610 id.getAncestor((node) => node is MethodDeclaration); | 583 id.getAncestor((node) => node is MethodDeclaration); |
| 611 Element element = ElementLocator.locate(declaration); | 584 Element element = ElementLocator.locate(declaration); |
| 612 EngineTestCase.assertInstanceOf( | 585 EngineTestCase.assertInstanceOf( |
| 613 (obj) => obj is MethodElement, MethodElement, element); | 586 (obj) => obj is MethodElement, MethodElement, element); |
| 614 } | 587 } |
| 615 | 588 |
| 616 test_locate_MethodInvocation_method() async { | 589 test_locate_MethodInvocation_method() async { |
| 617 AstNode id = await _findNodeIndexedIn( | 590 AstNode id = await _findNodeIndexedIn("bar", 1, r''' |
| 618 "bar", | |
| 619 1, | |
| 620 r''' | |
| 621 class A { | 591 class A { |
| 622 int bar() => 42; | 592 int bar() => 42; |
| 623 } | 593 } |
| 624 void main() { | 594 void main() { |
| 625 var f = new A().bar(); | 595 var f = new A().bar(); |
| 626 }'''); | 596 }'''); |
| 627 Element element = ElementLocator.locate(id); | 597 Element element = ElementLocator.locate(id); |
| 628 EngineTestCase.assertInstanceOf( | 598 EngineTestCase.assertInstanceOf( |
| 629 (obj) => obj is MethodElement, MethodElement, element); | 599 (obj) => obj is MethodElement, MethodElement, element); |
| 630 } | 600 } |
| 631 | 601 |
| 632 test_locate_MethodInvocation_topLevel() async { | 602 test_locate_MethodInvocation_topLevel() async { |
| 633 String code = r''' | 603 String code = r''' |
| 634 foo(x) {} | 604 foo(x) {} |
| 635 void main() { | 605 void main() { |
| 636 foo(0); | 606 foo(0); |
| 637 }'''; | 607 }'''; |
| 638 CompilationUnit cu = await _resolveContents(code); | 608 CompilationUnit cu = await _resolveContents(code); |
| 639 int offset = code.indexOf('foo(0)'); | 609 int offset = code.indexOf('foo(0)'); |
| 640 AstNode node = new NodeLocator(offset).searchWithin(cu); | 610 AstNode node = new NodeLocator(offset).searchWithin(cu); |
| 641 MethodInvocation invocation = | 611 MethodInvocation invocation = |
| 642 node.getAncestor((n) => n is MethodInvocation); | 612 node.getAncestor((n) => n is MethodInvocation); |
| 643 Element element = ElementLocator.locate(invocation); | 613 Element element = ElementLocator.locate(invocation); |
| 644 EngineTestCase.assertInstanceOf( | 614 EngineTestCase.assertInstanceOf( |
| 645 (obj) => obj is FunctionElement, FunctionElement, element); | 615 (obj) => obj is FunctionElement, FunctionElement, element); |
| 646 } | 616 } |
| 647 | 617 |
| 648 test_locate_PartOfDirective() async { | 618 test_locate_PartOfDirective() async { |
| 649 Source librarySource = addNamedSource( | 619 Source librarySource = addNamedSource('/lib.dart', ''' |
| 650 '/lib.dart', | |
| 651 ''' | |
| 652 library my.lib; | 620 library my.lib; |
| 653 part 'part.dart'; | 621 part 'part.dart'; |
| 654 '''); | 622 '''); |
| 655 Source unitSource = addNamedSource( | 623 Source unitSource = addNamedSource('/part.dart', ''' |
| 656 '/part.dart', | |
| 657 ''' | |
| 658 part of my.lib; | 624 part of my.lib; |
| 659 '''); | 625 '''); |
| 660 CompilationUnit unit = | 626 CompilationUnit unit = |
| 661 analysisContext.resolveCompilationUnit2(unitSource, librarySource); | 627 analysisContext.resolveCompilationUnit2(unitSource, librarySource); |
| 662 PartOfDirective partOf = unit.directives.first; | 628 PartOfDirective partOf = unit.directives.first; |
| 663 Element element = ElementLocator.locate(partOf); | 629 Element element = ElementLocator.locate(partOf); |
| 664 EngineTestCase.assertInstanceOf( | 630 EngineTestCase.assertInstanceOf( |
| 665 (obj) => obj is LibraryElement, LibraryElement, element); | 631 (obj) => obj is LibraryElement, LibraryElement, element); |
| 666 } | 632 } |
| 667 | 633 |
| 668 test_locate_PostfixExpression() async { | 634 test_locate_PostfixExpression() async { |
| 669 AstNode id = await _findNodeIn("++", "int addOne(int x) => x++;"); | 635 AstNode id = await _findNodeIn("++", "int addOne(int x) => x++;"); |
| 670 Element element = ElementLocator.locate(id); | 636 Element element = ElementLocator.locate(id); |
| 671 EngineTestCase.assertInstanceOf( | 637 EngineTestCase.assertInstanceOf( |
| 672 (obj) => obj is MethodElement, MethodElement, element); | 638 (obj) => obj is MethodElement, MethodElement, element); |
| 673 } | 639 } |
| 674 | 640 |
| 675 test_locate_PrefixedIdentifier() async { | 641 test_locate_PrefixedIdentifier() async { |
| 676 AstNode id = await _findNodeIn( | 642 AstNode id = await _findNodeIn("int", r''' |
| 677 "int", | |
| 678 r''' | |
| 679 import 'dart:core' as core; | 643 import 'dart:core' as core; |
| 680 core.int value;'''); | 644 core.int value;'''); |
| 681 PrefixedIdentifier identifier = | 645 PrefixedIdentifier identifier = |
| 682 id.getAncestor((node) => node is PrefixedIdentifier); | 646 id.getAncestor((node) => node is PrefixedIdentifier); |
| 683 Element element = ElementLocator.locate(identifier); | 647 Element element = ElementLocator.locate(identifier); |
| 684 EngineTestCase.assertInstanceOf( | 648 EngineTestCase.assertInstanceOf( |
| 685 (obj) => obj is ClassElement, ClassElement, element); | 649 (obj) => obj is ClassElement, ClassElement, element); |
| 686 } | 650 } |
| 687 | 651 |
| 688 test_locate_PrefixExpression() async { | 652 test_locate_PrefixExpression() async { |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 Uri result = resolveRelativeUri(base, contained); | 2146 Uri result = resolveRelativeUri(base, contained); |
| 2183 expect(result, isNotNull); | 2147 expect(result, isNotNull); |
| 2184 expect(result.toString(), expectedStr); | 2148 expect(result.toString(), expectedStr); |
| 2185 } | 2149 } |
| 2186 } | 2150 } |
| 2187 | 2151 |
| 2188 @deprecated | 2152 @deprecated |
| 2189 @reflectiveTest | 2153 @reflectiveTest |
| 2190 class SDKLibrariesReaderTest extends EngineTestCase { | 2154 class SDKLibrariesReaderTest extends EngineTestCase { |
| 2191 test_readFrom_dart2js() async { | 2155 test_readFrom_dart2js() async { |
| 2192 LibraryMap libraryMap = new SdkLibrariesReader(true).readFromFile( | 2156 LibraryMap libraryMap = new SdkLibrariesReader(true) |
| 2193 FileUtilities2.createFile("/libs.dart"), | 2157 .readFromFile(FileUtilities2.createFile("/libs.dart"), r''' |
| 2194 r''' | |
| 2195 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { | 2158 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
| 2196 'first' : const LibraryInfo( | 2159 'first' : const LibraryInfo( |
| 2197 'first/first.dart', | 2160 'first/first.dart', |
| 2198 categories: 'Client', | 2161 categories: 'Client', |
| 2199 documented: true, | 2162 documented: true, |
| 2200 platforms: VM_PLATFORM, | 2163 platforms: VM_PLATFORM, |
| 2201 dart2jsPath: 'first/first_dart2js.dart'), | 2164 dart2jsPath: 'first/first_dart2js.dart'), |
| 2202 };'''); | 2165 };'''); |
| 2203 expect(libraryMap, isNotNull); | 2166 expect(libraryMap, isNotNull); |
| 2204 expect(libraryMap.size(), 1); | 2167 expect(libraryMap.size(), 1); |
| 2205 SdkLibrary first = libraryMap.getLibrary("dart:first"); | 2168 SdkLibrary first = libraryMap.getLibrary("dart:first"); |
| 2206 expect(first, isNotNull); | 2169 expect(first, isNotNull); |
| 2207 expect(first.category, "Client"); | 2170 expect(first.category, "Client"); |
| 2208 expect(first.path, "first/first_dart2js.dart"); | 2171 expect(first.path, "first/first_dart2js.dart"); |
| 2209 expect(first.shortName, "dart:first"); | 2172 expect(first.shortName, "dart:first"); |
| 2210 expect(first.isDart2JsLibrary, false); | 2173 expect(first.isDart2JsLibrary, false); |
| 2211 expect(first.isDocumented, true); | 2174 expect(first.isDocumented, true); |
| 2212 expect(first.isImplementation, false); | 2175 expect(first.isImplementation, false); |
| 2213 expect(first.isVmLibrary, true); | 2176 expect(first.isVmLibrary, true); |
| 2214 } | 2177 } |
| 2215 | 2178 |
| 2216 test_readFrom_empty() async { | 2179 test_readFrom_empty() async { |
| 2217 LibraryMap libraryMap = new SdkLibrariesReader(false) | 2180 LibraryMap libraryMap = new SdkLibrariesReader(false) |
| 2218 .readFromFile(FileUtilities2.createFile("/libs.dart"), ""); | 2181 .readFromFile(FileUtilities2.createFile("/libs.dart"), ""); |
| 2219 expect(libraryMap, isNotNull); | 2182 expect(libraryMap, isNotNull); |
| 2220 expect(libraryMap.size(), 0); | 2183 expect(libraryMap.size(), 0); |
| 2221 } | 2184 } |
| 2222 | 2185 |
| 2223 test_readFrom_normal() async { | 2186 test_readFrom_normal() async { |
| 2224 LibraryMap libraryMap = new SdkLibrariesReader(false).readFromFile( | 2187 LibraryMap libraryMap = new SdkLibrariesReader(false) |
| 2225 FileUtilities2.createFile("/libs.dart"), | 2188 .readFromFile(FileUtilities2.createFile("/libs.dart"), r''' |
| 2226 r''' | |
| 2227 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { | 2189 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
| 2228 'first' : const LibraryInfo( | 2190 'first' : const LibraryInfo( |
| 2229 'first/first.dart', | 2191 'first/first.dart', |
| 2230 categories: 'Client', | 2192 categories: 'Client', |
| 2231 documented: true, | 2193 documented: true, |
| 2232 platforms: VM_PLATFORM), | 2194 platforms: VM_PLATFORM), |
| 2233 | 2195 |
| 2234 'second' : const LibraryInfo( | 2196 'second' : const LibraryInfo( |
| 2235 'second/second.dart', | 2197 'second/second.dart', |
| 2236 categories: 'Server', | 2198 categories: 'Server', |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2288 resourceProvider.newFolder(resourceProvider.convertPath('/sdk')); | 2250 resourceProvider.newFolder(resourceProvider.convertPath('/sdk')); |
| 2289 resourceProvider.newFile( | 2251 resourceProvider.newFile( |
| 2290 resourceProvider.convertPath( | 2252 resourceProvider.convertPath( |
| 2291 '/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart'), | 2253 '/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart'), |
| 2292 ''' | 2254 ''' |
| 2293 const Map<String, LibraryInfo> libraries = const { | 2255 const Map<String, LibraryInfo> libraries = const { |
| 2294 "core": const LibraryInfo("core/core.dart") | 2256 "core": const LibraryInfo("core/core.dart") |
| 2295 }; | 2257 }; |
| 2296 '''); | 2258 '''); |
| 2297 coreCorePath = resourceProvider.convertPath('/sdk/lib/core/core.dart'); | 2259 coreCorePath = resourceProvider.convertPath('/sdk/lib/core/core.dart'); |
| 2298 resourceProvider.newFile( | 2260 resourceProvider.newFile(coreCorePath, ''' |
| 2299 coreCorePath, | |
| 2300 ''' | |
| 2301 library dart.core; | 2261 library dart.core; |
| 2302 part 'int.dart'; | 2262 part 'int.dart'; |
| 2303 '''); | 2263 '''); |
| 2304 coreIntPath = resourceProvider.convertPath('/sdk/lib/core/int.dart'); | 2264 coreIntPath = resourceProvider.convertPath('/sdk/lib/core/int.dart'); |
| 2305 resourceProvider.newFile( | 2265 resourceProvider.newFile(coreIntPath, ''' |
| 2306 coreIntPath, | |
| 2307 ''' | |
| 2308 part of dart.core; | 2266 part of dart.core; |
| 2309 '''); | 2267 '''); |
| 2310 sdk = new FolderBasedDartSdk(resourceProvider, sdkFolder); | 2268 sdk = new FolderBasedDartSdk(resourceProvider, sdkFolder); |
| 2311 } | 2269 } |
| 2312 } | 2270 } |
| 2313 | 2271 |
| 2314 class _SourceMock extends TypedMock implements Source {} | 2272 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |