| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.utilities_test; | 8 library engine.utilities_test; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 runReflectiveTests(SourceRangeTest); | 30 runReflectiveTests(SourceRangeTest); |
| 31 runReflectiveTests(BooleanArrayTest); | 31 runReflectiveTests(BooleanArrayTest); |
| 32 runReflectiveTests(DirectedGraphTest); | 32 runReflectiveTests(DirectedGraphTest); |
| 33 runReflectiveTests(ListUtilitiesTest); | 33 runReflectiveTests(ListUtilitiesTest); |
| 34 runReflectiveTests(MultipleMapIteratorTest); | 34 runReflectiveTests(MultipleMapIteratorTest); |
| 35 runReflectiveTests(SingleMapIteratorTest); | 35 runReflectiveTests(SingleMapIteratorTest); |
| 36 runReflectiveTests(TokenMapTest); | 36 runReflectiveTests(TokenMapTest); |
| 37 runReflectiveTests(StringUtilitiesTest); | 37 runReflectiveTests(StringUtilitiesTest); |
| 38 } | 38 } |
| 39 | 39 |
| 40 class AstCloneComparator extends AstComparator { |
| 41 final bool expectTokensCopied; |
| 42 |
| 43 AstCloneComparator(this.expectTokensCopied); |
| 44 |
| 45 @override |
| 46 bool isEqualNodes(AstNode first, AstNode second) { |
| 47 if (first != null && identical(first, second)) { |
| 48 fail('Failed to copy node: $first (${first.offset})'); |
| 49 return false; |
| 50 } |
| 51 return super.isEqualNodes(first, second); |
| 52 } |
| 53 |
| 54 @override |
| 55 bool isEqualTokens(Token first, Token second) { |
| 56 if (expectTokensCopied && first != null && identical(first, second)) { |
| 57 fail('Failed to copy token: ${first.lexeme} (${first.offset})'); |
| 58 return false; |
| 59 } |
| 60 return super.isEqualTokens(first, second); |
| 61 } |
| 62 } |
| 63 |
| 40 class AstClonerTest extends EngineTestCase { | 64 class AstClonerTest extends EngineTestCase { |
| 41 void test_visitAdjacentStrings() { | 65 void test_visitAdjacentStrings() { |
| 42 _assertClone( | 66 _assertClone( |
| 43 AstFactory.adjacentStrings([AstFactory.string2("a"), AstFactory.string2(
"b")])); | 67 AstFactory.adjacentStrings([AstFactory.string2("a"), AstFactory.string2(
"b")])); |
| 44 } | 68 } |
| 45 | 69 |
| 46 void test_visitAnnotation_constant() { | 70 void test_visitAnnotation_constant() { |
| 47 _assertClone(AstFactory.annotation(AstFactory.identifier3("A"))); | 71 _assertClone(AstFactory.annotation(AstFactory.identifier3("A"))); |
| 48 } | 72 } |
| 49 | 73 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 109 } |
| 86 | 110 |
| 87 void test_visitBinaryExpression() { | 111 void test_visitBinaryExpression() { |
| 88 _assertClone( | 112 _assertClone( |
| 89 AstFactory.binaryExpression( | 113 AstFactory.binaryExpression( |
| 90 AstFactory.identifier3("a"), | 114 AstFactory.identifier3("a"), |
| 91 TokenType.PLUS, | 115 TokenType.PLUS, |
| 92 AstFactory.identifier3("b"))); | 116 AstFactory.identifier3("b"))); |
| 93 } | 117 } |
| 94 | 118 |
| 95 void test_visitBlockFunctionBody() { | |
| 96 _assertClone(AstFactory.blockFunctionBody2()); | |
| 97 } | |
| 98 | |
| 99 void test_visitBlock_empty() { | 119 void test_visitBlock_empty() { |
| 100 _assertClone(AstFactory.block()); | 120 _assertClone(AstFactory.block()); |
| 101 } | 121 } |
| 102 | 122 |
| 103 void test_visitBlock_nonEmpty() { | 123 void test_visitBlock_nonEmpty() { |
| 104 _assertClone( | 124 _assertClone( |
| 105 AstFactory.block([AstFactory.breakStatement(), AstFactory.breakStatement
()])); | 125 AstFactory.block([AstFactory.breakStatement(), AstFactory.breakStatement
()])); |
| 106 } | 126 } |
| 107 | 127 |
| 128 void test_visitBlockFunctionBody() { |
| 129 _assertClone(AstFactory.blockFunctionBody2()); |
| 130 } |
| 131 |
| 108 void test_visitBooleanLiteral_false() { | 132 void test_visitBooleanLiteral_false() { |
| 109 _assertClone(AstFactory.booleanLiteral(false)); | 133 _assertClone(AstFactory.booleanLiteral(false)); |
| 110 } | 134 } |
| 111 | 135 |
| 112 void test_visitBooleanLiteral_true() { | 136 void test_visitBooleanLiteral_true() { |
| 113 _assertClone(AstFactory.booleanLiteral(true)); | 137 _assertClone(AstFactory.booleanLiteral(true)); |
| 114 } | 138 } |
| 115 | 139 |
| 116 void test_visitBreakStatement_label() { | 140 void test_visitBreakStatement_label() { |
| 117 _assertClone(AstFactory.breakStatement2("l")); | 141 _assertClone(AstFactory.breakStatement2("l")); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 178 |
| 155 void test_visitCatchClause_catch_stack() { | 179 void test_visitCatchClause_catch_stack() { |
| 156 _assertClone(AstFactory.catchClause2("e", "s")); | 180 _assertClone(AstFactory.catchClause2("e", "s")); |
| 157 } | 181 } |
| 158 | 182 |
| 159 void test_visitCatchClause_on() { | 183 void test_visitCatchClause_on() { |
| 160 _assertClone(AstFactory.catchClause3(AstFactory.typeName4("E"))); | 184 _assertClone(AstFactory.catchClause3(AstFactory.typeName4("E"))); |
| 161 } | 185 } |
| 162 | 186 |
| 163 void test_visitCatchClause_on_catch() { | 187 void test_visitCatchClause_on_catch() { |
| 164 _assertClone( | 188 _assertClone(AstFactory.catchClause4(AstFactory.typeName4("E"), "e")); |
| 165 AstFactory.catchClause4(AstFactory.typeName4("E"), "e")); | |
| 166 } | 189 } |
| 167 | 190 |
| 168 void test_visitClassDeclaration_abstract() { | 191 void test_visitClassDeclaration_abstract() { |
| 169 _assertClone( | 192 _assertClone( |
| 170 AstFactory.classDeclaration(Keyword.ABSTRACT, "C", null, null, null, nul
l)); | 193 AstFactory.classDeclaration(Keyword.ABSTRACT, "C", null, null, null, nul
l)); |
| 171 } | 194 } |
| 172 | 195 |
| 173 void test_visitClassDeclaration_empty() { | 196 void test_visitClassDeclaration_empty() { |
| 174 _assertClone( | 197 _assertClone( |
| 175 AstFactory.classDeclaration(null, "C", null, null, null, null)); | 198 AstFactory.classDeclaration(null, "C", null, null, null, null)); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 486 |
| 464 void test_visitCompilationUnit_directive() { | 487 void test_visitCompilationUnit_directive() { |
| 465 _assertClone( | 488 _assertClone( |
| 466 AstFactory.compilationUnit3([AstFactory.libraryDirective2("l")])); | 489 AstFactory.compilationUnit3([AstFactory.libraryDirective2("l")])); |
| 467 } | 490 } |
| 468 | 491 |
| 469 void test_visitCompilationUnit_directive_declaration() { | 492 void test_visitCompilationUnit_directive_declaration() { |
| 470 _assertClone( | 493 _assertClone( |
| 471 AstFactory.compilationUnit4( | 494 AstFactory.compilationUnit4( |
| 472 [AstFactory.libraryDirective2("l")], | 495 [AstFactory.libraryDirective2("l")], |
| 473 [AstFactory.topLevelVariableDeclaration2( | 496 [ |
| 474 Keyword.VAR, | 497 AstFactory.topLevelVariableDeclaration2( |
| 475 [AstFactory.variableDeclaration("a")])])); | 498 Keyword.VAR, |
| 499 [AstFactory.variableDeclaration("a")])])); |
| 476 } | 500 } |
| 477 | 501 |
| 478 void test_visitCompilationUnit_empty() { | 502 void test_visitCompilationUnit_empty() { |
| 479 _assertClone(AstFactory.compilationUnit()); | 503 _assertClone(AstFactory.compilationUnit()); |
| 480 } | 504 } |
| 481 | 505 |
| 482 void test_visitCompilationUnit_script() { | 506 void test_visitCompilationUnit_script() { |
| 483 _assertClone(AstFactory.compilationUnit5("!#/bin/dartvm")); | 507 _assertClone(AstFactory.compilationUnit5("!#/bin/dartvm")); |
| 484 } | 508 } |
| 485 | 509 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 498 AstFactory.compilationUnit7( | 522 AstFactory.compilationUnit7( |
| 499 "!#/bin/dartvm", | 523 "!#/bin/dartvm", |
| 500 [AstFactory.libraryDirective2("l")])); | 524 [AstFactory.libraryDirective2("l")])); |
| 501 } | 525 } |
| 502 | 526 |
| 503 void test_visitCompilationUnit_script_directives_declarations() { | 527 void test_visitCompilationUnit_script_directives_declarations() { |
| 504 _assertClone( | 528 _assertClone( |
| 505 AstFactory.compilationUnit8( | 529 AstFactory.compilationUnit8( |
| 506 "!#/bin/dartvm", | 530 "!#/bin/dartvm", |
| 507 [AstFactory.libraryDirective2("l")], | 531 [AstFactory.libraryDirective2("l")], |
| 508 [AstFactory.topLevelVariableDeclaration2( | 532 [ |
| 509 Keyword.VAR, | 533 AstFactory.topLevelVariableDeclaration2( |
| 510 [AstFactory.variableDeclaration("a")])])); | 534 Keyword.VAR, |
| 535 [AstFactory.variableDeclaration("a")])])); |
| 511 } | 536 } |
| 512 | 537 |
| 513 void test_visitConditionalExpression() { | 538 void test_visitConditionalExpression() { |
| 514 _assertClone( | 539 _assertClone( |
| 515 AstFactory.conditionalExpression( | 540 AstFactory.conditionalExpression( |
| 516 AstFactory.identifier3("a"), | 541 AstFactory.identifier3("a"), |
| 517 AstFactory.identifier3("b"), | 542 AstFactory.identifier3("b"), |
| 518 AstFactory.identifier3("c"))); | 543 AstFactory.identifier3("c"))); |
| 519 } | 544 } |
| 520 | 545 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } | 577 } |
| 553 | 578 |
| 554 void test_visitConstructorDeclaration_multipleInitializers() { | 579 void test_visitConstructorDeclaration_multipleInitializers() { |
| 555 _assertClone( | 580 _assertClone( |
| 556 AstFactory.constructorDeclaration2( | 581 AstFactory.constructorDeclaration2( |
| 557 null, | 582 null, |
| 558 null, | 583 null, |
| 559 AstFactory.identifier3("C"), | 584 AstFactory.identifier3("C"), |
| 560 null, | 585 null, |
| 561 AstFactory.formalParameterList(), | 586 AstFactory.formalParameterList(), |
| 562 [AstFactory.constructorFieldInitializer(false, "a", AstFactory.ident
ifier3("b")), | 587 [ |
| 563 AstFactory.constructorFieldInitializer( | 588 AstFactory.constructorFieldInitializer(false, "a", AstFactory.id
entifier3("b")), |
| 564 false, | 589 AstFactory.constructorFieldInitializer( |
| 565 "c", | 590 false, |
| 566 AstFactory.identifier3("d"))], | 591 "c", |
| 592 AstFactory.identifier3("d"))], |
| 567 AstFactory.blockFunctionBody2())); | 593 AstFactory.blockFunctionBody2())); |
| 568 } | 594 } |
| 569 | 595 |
| 570 void test_visitConstructorDeclaration_multipleParameters() { | 596 void test_visitConstructorDeclaration_multipleParameters() { |
| 571 _assertClone( | 597 _assertClone( |
| 572 AstFactory.constructorDeclaration2( | 598 AstFactory.constructorDeclaration2( |
| 573 null, | 599 null, |
| 574 null, | 600 null, |
| 575 AstFactory.identifier3("C"), | 601 AstFactory.identifier3("C"), |
| 576 null, | 602 null, |
| 577 AstFactory.formalParameterList([ | 603 AstFactory.formalParameterList( |
| 578 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | 604 [ |
| 579 AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), | 605 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), |
| 606 AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), |
| 580 null, | 607 null, |
| 581 AstFactory.blockFunctionBody2())); | 608 AstFactory.blockFunctionBody2())); |
| 582 } | 609 } |
| 583 | 610 |
| 584 void test_visitConstructorDeclaration_named() { | 611 void test_visitConstructorDeclaration_named() { |
| 585 _assertClone( | 612 _assertClone( |
| 586 AstFactory.constructorDeclaration2( | 613 AstFactory.constructorDeclaration2( |
| 587 null, | 614 null, |
| 588 null, | 615 null, |
| 589 AstFactory.identifier3("C"), | 616 AstFactory.identifier3("C"), |
| 590 "m", | 617 "m", |
| 591 AstFactory.formalParameterList(), | 618 AstFactory.formalParameterList(), |
| 592 null, | 619 null, |
| 593 AstFactory.blockFunctionBody2())); | 620 AstFactory.blockFunctionBody2())); |
| 594 } | 621 } |
| 595 | 622 |
| 596 void test_visitConstructorDeclaration_singleInitializer() { | 623 void test_visitConstructorDeclaration_singleInitializer() { |
| 597 _assertClone( | 624 _assertClone( |
| 598 AstFactory.constructorDeclaration2( | 625 AstFactory.constructorDeclaration2( |
| 599 null, | 626 null, |
| 600 null, | 627 null, |
| 601 AstFactory.identifier3("C"), | 628 AstFactory.identifier3("C"), |
| 602 null, | 629 null, |
| 603 AstFactory.formalParameterList(), | 630 AstFactory.formalParameterList(), |
| 604 [AstFactory.constructorFieldInitializer( | 631 [ |
| 605 false, | 632 AstFactory.constructorFieldInitializer( |
| 606 "a", | 633 false, |
| 607 AstFactory.identifier3("b"))], | 634 "a", |
| 635 AstFactory.identifier3("b"))], |
| 608 AstFactory.blockFunctionBody2())); | 636 AstFactory.blockFunctionBody2())); |
| 609 } | 637 } |
| 610 | 638 |
| 611 void test_visitConstructorDeclaration_withMetadata() { | 639 void test_visitConstructorDeclaration_withMetadata() { |
| 612 ConstructorDeclaration declaration = AstFactory.constructorDeclaration2( | 640 ConstructorDeclaration declaration = AstFactory.constructorDeclaration2( |
| 613 null, | 641 null, |
| 614 null, | 642 null, |
| 615 AstFactory.identifier3("C"), | 643 AstFactory.identifier3("C"), |
| 616 null, | 644 null, |
| 617 AstFactory.formalParameterList(), | 645 AstFactory.formalParameterList(), |
| 618 null, | 646 null, |
| 619 AstFactory.blockFunctionBody2()); | 647 AstFactory.blockFunctionBody2()); |
| 620 declaration.metadata = | 648 declaration.metadata = |
| 621 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; | 649 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; |
| 622 _assertClone(declaration); | 650 _assertClone(declaration); |
| 623 } | 651 } |
| 624 | 652 |
| 625 void test_visitConstructorFieldInitializer_withThis() { | |
| 626 _assertClone( | |
| 627 AstFactory.constructorFieldInitializer(true, "a", AstFactory.identifier3
("b"))); | |
| 628 } | |
| 629 | |
| 630 void test_visitConstructorFieldInitializer_withoutThis() { | 653 void test_visitConstructorFieldInitializer_withoutThis() { |
| 631 _assertClone( | 654 _assertClone( |
| 632 AstFactory.constructorFieldInitializer( | 655 AstFactory.constructorFieldInitializer( |
| 633 false, | 656 false, |
| 634 "a", | 657 "a", |
| 635 AstFactory.identifier3("b"))); | 658 AstFactory.identifier3("b"))); |
| 636 } | 659 } |
| 637 | 660 |
| 661 void test_visitConstructorFieldInitializer_withThis() { |
| 662 _assertClone( |
| 663 AstFactory.constructorFieldInitializer(true, "a", AstFactory.identifier3
("b"))); |
| 664 } |
| 665 |
| 638 void test_visitConstructorName_named_prefix() { | 666 void test_visitConstructorName_named_prefix() { |
| 639 _assertClone( | 667 _assertClone( |
| 640 AstFactory.constructorName(AstFactory.typeName4("p.C.n"), null)); | 668 AstFactory.constructorName(AstFactory.typeName4("p.C.n"), null)); |
| 641 } | 669 } |
| 642 | 670 |
| 643 void test_visitConstructorName_unnamed_noPrefix() { | 671 void test_visitConstructorName_unnamed_noPrefix() { |
| 644 _assertClone( | 672 _assertClone(AstFactory.constructorName(AstFactory.typeName4("C"), null)); |
| 645 AstFactory.constructorName(AstFactory.typeName4("C"), null)); | |
| 646 } | 673 } |
| 647 | 674 |
| 648 void test_visitConstructorName_unnamed_prefix() { | 675 void test_visitConstructorName_unnamed_prefix() { |
| 649 _assertClone( | 676 _assertClone( |
| 650 AstFactory.constructorName( | 677 AstFactory.constructorName( |
| 651 AstFactory.typeName3(AstFactory.identifier5("p", "C")), | 678 AstFactory.typeName3(AstFactory.identifier5("p", "C")), |
| 652 null)); | 679 null)); |
| 653 } | 680 } |
| 654 | 681 |
| 655 void test_visitContinueStatement_label() { | 682 void test_visitContinueStatement_label() { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 "a", | 804 "a", |
| 778 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("b
")]))); | 805 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("b
")]))); |
| 779 } | 806 } |
| 780 | 807 |
| 781 void test_visitFieldFormalParameter_keyword() { | 808 void test_visitFieldFormalParameter_keyword() { |
| 782 _assertClone(AstFactory.fieldFormalParameter(Keyword.VAR, null, "a")); | 809 _assertClone(AstFactory.fieldFormalParameter(Keyword.VAR, null, "a")); |
| 783 } | 810 } |
| 784 | 811 |
| 785 void test_visitFieldFormalParameter_keywordAndType() { | 812 void test_visitFieldFormalParameter_keywordAndType() { |
| 786 _assertClone( | 813 _assertClone( |
| 787 AstFactory.fieldFormalParameter( | 814 AstFactory.fieldFormalParameter(Keyword.FINAL, AstFactory.typeName4("A")
, "a")); |
| 788 Keyword.FINAL, | |
| 789 AstFactory.typeName4("A"), | |
| 790 "a")); | |
| 791 } | 815 } |
| 792 | 816 |
| 793 void test_visitFieldFormalParameter_type() { | 817 void test_visitFieldFormalParameter_type() { |
| 794 _assertClone( | 818 _assertClone( |
| 795 AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a")); | 819 AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a")); |
| 796 } | 820 } |
| 797 | 821 |
| 798 void test_visitForEachStatement_declared() { | 822 void test_visitForEachStatement_declared() { |
| 799 _assertClone( | 823 _assertClone( |
| 800 AstFactory.forEachStatement( | 824 AstFactory.forEachStatement( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 822 TokenFactory.tokenFromString("await"), | 846 TokenFactory.tokenFromString("await"), |
| 823 TokenFactory.tokenFromKeyword(Keyword.FOR), | 847 TokenFactory.tokenFromKeyword(Keyword.FOR), |
| 824 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 848 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 825 AstFactory.identifier3("a"), | 849 AstFactory.identifier3("a"), |
| 826 TokenFactory.tokenFromKeyword(Keyword.IN), | 850 TokenFactory.tokenFromKeyword(Keyword.IN), |
| 827 AstFactory.identifier3("b"), | 851 AstFactory.identifier3("b"), |
| 828 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | 852 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), |
| 829 AstFactory.block())); | 853 AstFactory.block())); |
| 830 } | 854 } |
| 831 | 855 |
| 832 void test_visitForStatement_c() { | |
| 833 _assertClone( | |
| 834 AstFactory.forStatement( | |
| 835 null, | |
| 836 AstFactory.identifier3("c"), | |
| 837 null, | |
| 838 AstFactory.block())); | |
| 839 } | |
| 840 | |
| 841 void test_visitForStatement_cu() { | |
| 842 _assertClone( | |
| 843 AstFactory.forStatement( | |
| 844 null, | |
| 845 AstFactory.identifier3("c"), | |
| 846 [AstFactory.identifier3("u")], | |
| 847 AstFactory.block())); | |
| 848 } | |
| 849 | |
| 850 void test_visitForStatement_e() { | |
| 851 _assertClone( | |
| 852 AstFactory.forStatement( | |
| 853 AstFactory.identifier3("e"), | |
| 854 null, | |
| 855 null, | |
| 856 AstFactory.block())); | |
| 857 } | |
| 858 | |
| 859 void test_visitForStatement_ec() { | |
| 860 _assertClone( | |
| 861 AstFactory.forStatement( | |
| 862 AstFactory.identifier3("e"), | |
| 863 AstFactory.identifier3("c"), | |
| 864 null, | |
| 865 AstFactory.block())); | |
| 866 } | |
| 867 | |
| 868 void test_visitForStatement_ecu() { | |
| 869 _assertClone( | |
| 870 AstFactory.forStatement( | |
| 871 AstFactory.identifier3("e"), | |
| 872 AstFactory.identifier3("c"), | |
| 873 [AstFactory.identifier3("u")], | |
| 874 AstFactory.block())); | |
| 875 } | |
| 876 | |
| 877 void test_visitForStatement_eu() { | |
| 878 _assertClone( | |
| 879 AstFactory.forStatement( | |
| 880 AstFactory.identifier3("e"), | |
| 881 null, | |
| 882 [AstFactory.identifier3("u")], | |
| 883 AstFactory.block())); | |
| 884 } | |
| 885 | |
| 886 void test_visitForStatement_i() { | |
| 887 _assertClone( | |
| 888 AstFactory.forStatement2( | |
| 889 AstFactory.variableDeclarationList2( | |
| 890 Keyword.VAR, | |
| 891 [AstFactory.variableDeclaration("i")]), | |
| 892 null, | |
| 893 null, | |
| 894 AstFactory.block())); | |
| 895 } | |
| 896 | |
| 897 void test_visitForStatement_ic() { | |
| 898 _assertClone( | |
| 899 AstFactory.forStatement2( | |
| 900 AstFactory.variableDeclarationList2( | |
| 901 Keyword.VAR, | |
| 902 [AstFactory.variableDeclaration("i")]), | |
| 903 AstFactory.identifier3("c"), | |
| 904 null, | |
| 905 AstFactory.block())); | |
| 906 } | |
| 907 | |
| 908 void test_visitForStatement_icu() { | |
| 909 _assertClone( | |
| 910 AstFactory.forStatement2( | |
| 911 AstFactory.variableDeclarationList2( | |
| 912 Keyword.VAR, | |
| 913 [AstFactory.variableDeclaration("i")]), | |
| 914 AstFactory.identifier3("c"), | |
| 915 [AstFactory.identifier3("u")], | |
| 916 AstFactory.block())); | |
| 917 } | |
| 918 | |
| 919 void test_visitForStatement_iu() { | |
| 920 _assertClone( | |
| 921 AstFactory.forStatement2( | |
| 922 AstFactory.variableDeclarationList2( | |
| 923 Keyword.VAR, | |
| 924 [AstFactory.variableDeclaration("i")]), | |
| 925 null, | |
| 926 [AstFactory.identifier3("u")], | |
| 927 AstFactory.block())); | |
| 928 } | |
| 929 | |
| 930 void test_visitForStatement_u() { | |
| 931 _assertClone( | |
| 932 AstFactory.forStatement( | |
| 933 null, | |
| 934 null, | |
| 935 [AstFactory.identifier3("u")], | |
| 936 AstFactory.block())); | |
| 937 } | |
| 938 | |
| 939 void test_visitFormalParameterList_empty() { | 856 void test_visitFormalParameterList_empty() { |
| 940 _assertClone(AstFactory.formalParameterList()); | 857 _assertClone(AstFactory.formalParameterList()); |
| 941 } | 858 } |
| 942 | 859 |
| 943 void test_visitFormalParameterList_n() { | 860 void test_visitFormalParameterList_n() { |
| 944 _assertClone( | 861 _assertClone( |
| 945 AstFactory.formalParameterList( | 862 AstFactory.formalParameterList( |
| 946 [ | 863 [ |
| 947 AstFactory.namedFormalParameter( | 864 AstFactory.namedFormalParameter( |
| 948 AstFactory.simpleFormalParameter3("a"), | 865 AstFactory.simpleFormalParameter3("a"), |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 AstFactory.simpleFormalParameter3("a"), | 1001 AstFactory.simpleFormalParameter3("a"), |
| 1085 AstFactory.simpleFormalParameter3("b"), | 1002 AstFactory.simpleFormalParameter3("b"), |
| 1086 AstFactory.positionalFormalParameter( | 1003 AstFactory.positionalFormalParameter( |
| 1087 AstFactory.simpleFormalParameter3("c"), | 1004 AstFactory.simpleFormalParameter3("c"), |
| 1088 AstFactory.integer(3)), | 1005 AstFactory.integer(3)), |
| 1089 AstFactory.positionalFormalParameter( | 1006 AstFactory.positionalFormalParameter( |
| 1090 AstFactory.simpleFormalParameter3("d"), | 1007 AstFactory.simpleFormalParameter3("d"), |
| 1091 AstFactory.integer(4))])); | 1008 AstFactory.integer(4))])); |
| 1092 } | 1009 } |
| 1093 | 1010 |
| 1094 void test_visitFunctionDeclarationStatement() { | 1011 void test_visitForStatement_c() { |
| 1095 _assertClone( | 1012 _assertClone( |
| 1096 AstFactory.functionDeclarationStatement( | 1013 AstFactory.forStatement( |
| 1014 null, |
| 1015 AstFactory.identifier3("c"), |
| 1016 null, |
| 1017 AstFactory.block())); |
| 1018 } |
| 1019 |
| 1020 void test_visitForStatement_cu() { |
| 1021 _assertClone( |
| 1022 AstFactory.forStatement( |
| 1023 null, |
| 1024 AstFactory.identifier3("c"), |
| 1025 [AstFactory.identifier3("u")], |
| 1026 AstFactory.block())); |
| 1027 } |
| 1028 |
| 1029 void test_visitForStatement_e() { |
| 1030 _assertClone( |
| 1031 AstFactory.forStatement( |
| 1032 AstFactory.identifier3("e"), |
| 1097 null, | 1033 null, |
| 1098 null, | 1034 null, |
| 1099 "f", | 1035 AstFactory.block())); |
| 1100 AstFactory.functionExpression())); | 1036 } |
| 1037 |
| 1038 void test_visitForStatement_ec() { |
| 1039 _assertClone( |
| 1040 AstFactory.forStatement( |
| 1041 AstFactory.identifier3("e"), |
| 1042 AstFactory.identifier3("c"), |
| 1043 null, |
| 1044 AstFactory.block())); |
| 1045 } |
| 1046 |
| 1047 void test_visitForStatement_ecu() { |
| 1048 _assertClone( |
| 1049 AstFactory.forStatement( |
| 1050 AstFactory.identifier3("e"), |
| 1051 AstFactory.identifier3("c"), |
| 1052 [AstFactory.identifier3("u")], |
| 1053 AstFactory.block())); |
| 1054 } |
| 1055 |
| 1056 void test_visitForStatement_eu() { |
| 1057 _assertClone( |
| 1058 AstFactory.forStatement( |
| 1059 AstFactory.identifier3("e"), |
| 1060 null, |
| 1061 [AstFactory.identifier3("u")], |
| 1062 AstFactory.block())); |
| 1063 } |
| 1064 |
| 1065 void test_visitForStatement_i() { |
| 1066 _assertClone( |
| 1067 AstFactory.forStatement2( |
| 1068 AstFactory.variableDeclarationList2( |
| 1069 Keyword.VAR, |
| 1070 [AstFactory.variableDeclaration("i")]), |
| 1071 null, |
| 1072 null, |
| 1073 AstFactory.block())); |
| 1074 } |
| 1075 |
| 1076 void test_visitForStatement_ic() { |
| 1077 _assertClone( |
| 1078 AstFactory.forStatement2( |
| 1079 AstFactory.variableDeclarationList2( |
| 1080 Keyword.VAR, |
| 1081 [AstFactory.variableDeclaration("i")]), |
| 1082 AstFactory.identifier3("c"), |
| 1083 null, |
| 1084 AstFactory.block())); |
| 1085 } |
| 1086 |
| 1087 void test_visitForStatement_icu() { |
| 1088 _assertClone( |
| 1089 AstFactory.forStatement2( |
| 1090 AstFactory.variableDeclarationList2( |
| 1091 Keyword.VAR, |
| 1092 [AstFactory.variableDeclaration("i")]), |
| 1093 AstFactory.identifier3("c"), |
| 1094 [AstFactory.identifier3("u")], |
| 1095 AstFactory.block())); |
| 1096 } |
| 1097 |
| 1098 void test_visitForStatement_iu() { |
| 1099 _assertClone( |
| 1100 AstFactory.forStatement2( |
| 1101 AstFactory.variableDeclarationList2( |
| 1102 Keyword.VAR, |
| 1103 [AstFactory.variableDeclaration("i")]), |
| 1104 null, |
| 1105 [AstFactory.identifier3("u")], |
| 1106 AstFactory.block())); |
| 1107 } |
| 1108 |
| 1109 void test_visitForStatement_u() { |
| 1110 _assertClone( |
| 1111 AstFactory.forStatement( |
| 1112 null, |
| 1113 null, |
| 1114 [AstFactory.identifier3("u")], |
| 1115 AstFactory.block())); |
| 1101 } | 1116 } |
| 1102 | 1117 |
| 1103 void test_visitFunctionDeclaration_getter() { | 1118 void test_visitFunctionDeclaration_getter() { |
| 1104 _assertClone( | 1119 _assertClone( |
| 1105 AstFactory.functionDeclaration( | 1120 AstFactory.functionDeclaration( |
| 1106 null, | 1121 null, |
| 1107 Keyword.GET, | 1122 Keyword.GET, |
| 1108 "f", | 1123 "f", |
| 1109 AstFactory.functionExpression())); | 1124 AstFactory.functionExpression())); |
| 1110 } | 1125 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1131 FunctionDeclaration declaration = AstFactory.functionDeclaration( | 1146 FunctionDeclaration declaration = AstFactory.functionDeclaration( |
| 1132 null, | 1147 null, |
| 1133 null, | 1148 null, |
| 1134 "f", | 1149 "f", |
| 1135 AstFactory.functionExpression()); | 1150 AstFactory.functionExpression()); |
| 1136 declaration.metadata = | 1151 declaration.metadata = |
| 1137 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; | 1152 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; |
| 1138 _assertClone(declaration); | 1153 _assertClone(declaration); |
| 1139 } | 1154 } |
| 1140 | 1155 |
| 1156 void test_visitFunctionDeclarationStatement() { |
| 1157 _assertClone( |
| 1158 AstFactory.functionDeclarationStatement( |
| 1159 null, |
| 1160 null, |
| 1161 "f", |
| 1162 AstFactory.functionExpression())); |
| 1163 } |
| 1164 |
| 1141 void test_visitFunctionExpression() { | 1165 void test_visitFunctionExpression() { |
| 1142 _assertClone(AstFactory.functionExpression()); | 1166 _assertClone(AstFactory.functionExpression()); |
| 1143 } | 1167 } |
| 1144 | 1168 |
| 1145 void test_visitFunctionExpressionInvocation() { | 1169 void test_visitFunctionExpressionInvocation() { |
| 1146 _assertClone( | 1170 _assertClone( |
| 1147 AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"))); | 1171 AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"))); |
| 1148 } | 1172 } |
| 1149 | 1173 |
| 1150 void test_visitFunctionTypeAlias_generic() { | 1174 void test_visitFunctionTypeAlias_generic() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1175 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; | 1199 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; |
| 1176 _assertClone(declaration); | 1200 _assertClone(declaration); |
| 1177 } | 1201 } |
| 1178 | 1202 |
| 1179 void test_visitFunctionTypedFormalParameter_noType() { | 1203 void test_visitFunctionTypedFormalParameter_noType() { |
| 1180 _assertClone(AstFactory.functionTypedFormalParameter(null, "f")); | 1204 _assertClone(AstFactory.functionTypedFormalParameter(null, "f")); |
| 1181 } | 1205 } |
| 1182 | 1206 |
| 1183 void test_visitFunctionTypedFormalParameter_type() { | 1207 void test_visitFunctionTypedFormalParameter_type() { |
| 1184 _assertClone( | 1208 _assertClone( |
| 1185 AstFactory.functionTypedFormalParameter( | 1209 AstFactory.functionTypedFormalParameter(AstFactory.typeName4("T"), "f"))
; |
| 1186 AstFactory.typeName4("T"), | |
| 1187 "f")); | |
| 1188 } | 1210 } |
| 1189 | 1211 |
| 1190 void test_visitIfStatement_withElse() { | 1212 void test_visitIfStatement_withElse() { |
| 1191 _assertClone( | 1213 _assertClone( |
| 1192 AstFactory.ifStatement2( | 1214 AstFactory.ifStatement2( |
| 1193 AstFactory.identifier3("c"), | 1215 AstFactory.identifier3("c"), |
| 1194 AstFactory.block(), | 1216 AstFactory.block(), |
| 1195 AstFactory.block())); | 1217 AstFactory.block())); |
| 1196 } | 1218 } |
| 1197 | 1219 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 void test_visitInstanceCreationExpression_named() { | 1320 void test_visitInstanceCreationExpression_named() { |
| 1299 _assertClone( | 1321 _assertClone( |
| 1300 AstFactory.instanceCreationExpression3( | 1322 AstFactory.instanceCreationExpression3( |
| 1301 Keyword.NEW, | 1323 Keyword.NEW, |
| 1302 AstFactory.typeName4("C"), | 1324 AstFactory.typeName4("C"), |
| 1303 "c")); | 1325 "c")); |
| 1304 } | 1326 } |
| 1305 | 1327 |
| 1306 void test_visitInstanceCreationExpression_unnamed() { | 1328 void test_visitInstanceCreationExpression_unnamed() { |
| 1307 _assertClone( | 1329 _assertClone( |
| 1308 AstFactory.instanceCreationExpression2( | 1330 AstFactory.instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4
("C"))); |
| 1309 Keyword.NEW, | |
| 1310 AstFactory.typeName4("C"))); | |
| 1311 } | 1331 } |
| 1312 | 1332 |
| 1313 void test_visitIntegerLiteral() { | 1333 void test_visitIntegerLiteral() { |
| 1314 _assertClone(AstFactory.integer(42)); | 1334 _assertClone(AstFactory.integer(42)); |
| 1315 } | 1335 } |
| 1316 | 1336 |
| 1317 void test_visitInterpolationExpression_expression() { | 1337 void test_visitInterpolationExpression_expression() { |
| 1318 _assertClone( | 1338 _assertClone( |
| 1319 AstFactory.interpolationExpression(AstFactory.identifier3("a"))); | 1339 AstFactory.interpolationExpression(AstFactory.identifier3("a"))); |
| 1320 } | 1340 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 | 1415 |
| 1396 void test_visitListLiteral_nonEmpty() { | 1416 void test_visitListLiteral_nonEmpty() { |
| 1397 _assertClone( | 1417 _assertClone( |
| 1398 AstFactory.listLiteral( | 1418 AstFactory.listLiteral( |
| 1399 [ | 1419 [ |
| 1400 AstFactory.identifier3("a"), | 1420 AstFactory.identifier3("a"), |
| 1401 AstFactory.identifier3("b"), | 1421 AstFactory.identifier3("b"), |
| 1402 AstFactory.identifier3("c")])); | 1422 AstFactory.identifier3("c")])); |
| 1403 } | 1423 } |
| 1404 | 1424 |
| 1405 void test_visitMapLiteralEntry() { | |
| 1406 _assertClone(AstFactory.mapLiteralEntry("a", AstFactory.identifier3("b"))); | |
| 1407 } | |
| 1408 | |
| 1409 void test_visitMapLiteral_const() { | 1425 void test_visitMapLiteral_const() { |
| 1410 _assertClone(AstFactory.mapLiteral(Keyword.CONST, null)); | 1426 _assertClone(AstFactory.mapLiteral(Keyword.CONST, null)); |
| 1411 } | 1427 } |
| 1412 | 1428 |
| 1413 void test_visitMapLiteral_empty() { | 1429 void test_visitMapLiteral_empty() { |
| 1414 _assertClone(AstFactory.mapLiteral2()); | 1430 _assertClone(AstFactory.mapLiteral2()); |
| 1415 } | 1431 } |
| 1416 | 1432 |
| 1417 void test_visitMapLiteral_nonEmpty() { | 1433 void test_visitMapLiteral_nonEmpty() { |
| 1418 _assertClone( | 1434 _assertClone( |
| 1419 AstFactory.mapLiteral2( | 1435 AstFactory.mapLiteral2( |
| 1420 [ | 1436 [ |
| 1421 AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")), | 1437 AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")), |
| 1422 AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")), | 1438 AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")), |
| 1423 AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c"))])); | 1439 AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c"))])); |
| 1424 } | 1440 } |
| 1425 | 1441 |
| 1442 void test_visitMapLiteralEntry() { |
| 1443 _assertClone(AstFactory.mapLiteralEntry("a", AstFactory.identifier3("b"))); |
| 1444 } |
| 1445 |
| 1426 void test_visitMethodDeclaration_external() { | 1446 void test_visitMethodDeclaration_external() { |
| 1427 _assertClone( | 1447 _assertClone( |
| 1428 AstFactory.methodDeclaration( | 1448 AstFactory.methodDeclaration( |
| 1429 null, | 1449 null, |
| 1430 null, | 1450 null, |
| 1431 null, | 1451 null, |
| 1432 null, | 1452 null, |
| 1433 AstFactory.identifier3("m"), | 1453 AstFactory.identifier3("m"), |
| 1434 AstFactory.formalParameterList())); | 1454 AstFactory.formalParameterList())); |
| 1435 } | 1455 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 declaration.metadata = | 1614 declaration.metadata = |
| 1595 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; | 1615 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; |
| 1596 _assertClone(declaration); | 1616 _assertClone(declaration); |
| 1597 } | 1617 } |
| 1598 | 1618 |
| 1599 void test_visitMethodInvocation_noTarget() { | 1619 void test_visitMethodInvocation_noTarget() { |
| 1600 _assertClone(AstFactory.methodInvocation2("m")); | 1620 _assertClone(AstFactory.methodInvocation2("m")); |
| 1601 } | 1621 } |
| 1602 | 1622 |
| 1603 void test_visitMethodInvocation_target() { | 1623 void test_visitMethodInvocation_target() { |
| 1604 _assertClone( | 1624 _assertClone(AstFactory.methodInvocation(AstFactory.identifier3("t"), "m")); |
| 1605 AstFactory.methodInvocation(AstFactory.identifier3("t"), "m")); | |
| 1606 } | 1625 } |
| 1607 | 1626 |
| 1608 void test_visitNamedExpression() { | 1627 void test_visitNamedExpression() { |
| 1609 _assertClone(AstFactory.namedExpression2("a", AstFactory.identifier3("b"))); | 1628 _assertClone(AstFactory.namedExpression2("a", AstFactory.identifier3("b"))); |
| 1610 } | 1629 } |
| 1611 | 1630 |
| 1612 void test_visitNamedFormalParameter() { | 1631 void test_visitNamedFormalParameter() { |
| 1613 _assertClone( | 1632 _assertClone( |
| 1614 AstFactory.namedFormalParameter( | 1633 AstFactory.namedFormalParameter( |
| 1615 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | 1634 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 AstFactory.positionalFormalParameter( | 1681 AstFactory.positionalFormalParameter( |
| 1663 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | 1682 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), |
| 1664 AstFactory.integer(0))); | 1683 AstFactory.integer(0))); |
| 1665 } | 1684 } |
| 1666 | 1685 |
| 1667 void test_visitPostfixExpression() { | 1686 void test_visitPostfixExpression() { |
| 1668 _assertClone( | 1687 _assertClone( |
| 1669 AstFactory.postfixExpression(AstFactory.identifier3("a"), TokenType.PLUS
_PLUS)); | 1688 AstFactory.postfixExpression(AstFactory.identifier3("a"), TokenType.PLUS
_PLUS)); |
| 1670 } | 1689 } |
| 1671 | 1690 |
| 1691 void test_visitPrefixedIdentifier() { |
| 1692 _assertClone(AstFactory.identifier5("a", "b")); |
| 1693 } |
| 1694 |
| 1672 void test_visitPrefixExpression() { | 1695 void test_visitPrefixExpression() { |
| 1673 _assertClone( | 1696 _assertClone( |
| 1674 AstFactory.prefixExpression(TokenType.MINUS, AstFactory.identifier3("a")
)); | 1697 AstFactory.prefixExpression(TokenType.MINUS, AstFactory.identifier3("a")
)); |
| 1675 } | 1698 } |
| 1676 | 1699 |
| 1677 void test_visitPrefixedIdentifier() { | |
| 1678 _assertClone(AstFactory.identifier5("a", "b")); | |
| 1679 } | |
| 1680 | |
| 1681 void test_visitPropertyAccess() { | 1700 void test_visitPropertyAccess() { |
| 1682 _assertClone(AstFactory.propertyAccess2(AstFactory.identifier3("a"), "b")); | 1701 _assertClone(AstFactory.propertyAccess2(AstFactory.identifier3("a"), "b")); |
| 1683 } | 1702 } |
| 1684 | 1703 |
| 1685 void test_visitRedirectingConstructorInvocation_named() { | 1704 void test_visitRedirectingConstructorInvocation_named() { |
| 1686 _assertClone(AstFactory.redirectingConstructorInvocation2("c")); | 1705 _assertClone(AstFactory.redirectingConstructorInvocation2("c")); |
| 1687 } | 1706 } |
| 1688 | 1707 |
| 1689 void test_visitRedirectingConstructorInvocation_unnamed() { | 1708 void test_visitRedirectingConstructorInvocation_unnamed() { |
| 1690 _assertClone(AstFactory.redirectingConstructorInvocation()); | 1709 _assertClone(AstFactory.redirectingConstructorInvocation()); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 _assertClone( | 1811 _assertClone( |
| 1793 AstFactory.switchDefault2([AstFactory.block(), AstFactory.block()])); | 1812 AstFactory.switchDefault2([AstFactory.block(), AstFactory.block()])); |
| 1794 } | 1813 } |
| 1795 | 1814 |
| 1796 void test_visitSwitchDefault_noLabels() { | 1815 void test_visitSwitchDefault_noLabels() { |
| 1797 _assertClone(AstFactory.switchDefault2([AstFactory.block()])); | 1816 _assertClone(AstFactory.switchDefault2([AstFactory.block()])); |
| 1798 } | 1817 } |
| 1799 | 1818 |
| 1800 void test_visitSwitchDefault_singleLabel() { | 1819 void test_visitSwitchDefault_singleLabel() { |
| 1801 _assertClone( | 1820 _assertClone( |
| 1802 AstFactory.switchDefault( | 1821 AstFactory.switchDefault([AstFactory.label2("l1")], [AstFactory.block()]
)); |
| 1803 [AstFactory.label2("l1")], | |
| 1804 [AstFactory.block()])); | |
| 1805 } | 1822 } |
| 1806 | 1823 |
| 1807 void test_visitSwitchStatement() { | 1824 void test_visitSwitchStatement() { |
| 1808 _assertClone( | 1825 _assertClone( |
| 1809 AstFactory.switchStatement( | 1826 AstFactory.switchStatement( |
| 1810 AstFactory.identifier3("a"), | 1827 AstFactory.identifier3("a"), |
| 1811 [ | 1828 [ |
| 1812 AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block
()]), | 1829 AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block
()]), |
| 1813 AstFactory.switchDefault2([AstFactory.block()])])); | 1830 AstFactory.switchDefault2([AstFactory.block()])])); |
| 1814 } | 1831 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1843 [AstFactory.variableDeclaration("a"), AstFactory.variableDeclaration
("b")])); | 1860 [AstFactory.variableDeclaration("a"), AstFactory.variableDeclaration
("b")])); |
| 1844 } | 1861 } |
| 1845 | 1862 |
| 1846 void test_visitTryStatement_catch() { | 1863 void test_visitTryStatement_catch() { |
| 1847 _assertClone( | 1864 _assertClone( |
| 1848 AstFactory.tryStatement2( | 1865 AstFactory.tryStatement2( |
| 1849 AstFactory.block(), | 1866 AstFactory.block(), |
| 1850 [AstFactory.catchClause3(AstFactory.typeName4("E"))])); | 1867 [AstFactory.catchClause3(AstFactory.typeName4("E"))])); |
| 1851 } | 1868 } |
| 1852 | 1869 |
| 1853 void test_visitTryStatement_catchFinally() { | |
| 1854 _assertClone( | |
| 1855 AstFactory.tryStatement3( | |
| 1856 AstFactory.block(), | |
| 1857 [AstFactory.catchClause3(AstFactory.typeName4("E"))], | |
| 1858 AstFactory.block())); | |
| 1859 } | |
| 1860 | |
| 1861 void test_visitTryStatement_catches() { | 1870 void test_visitTryStatement_catches() { |
| 1862 _assertClone( | 1871 _assertClone( |
| 1863 AstFactory.tryStatement2( | 1872 AstFactory.tryStatement2( |
| 1864 AstFactory.block(), | 1873 AstFactory.block(), |
| 1865 [ | 1874 [ |
| 1866 AstFactory.catchClause3(AstFactory.typeName4("E")), | 1875 AstFactory.catchClause3(AstFactory.typeName4("E")), |
| 1867 AstFactory.catchClause3(AstFactory.typeName4("F"))])); | 1876 AstFactory.catchClause3(AstFactory.typeName4("F"))])); |
| 1868 } | 1877 } |
| 1869 | 1878 |
| 1879 void test_visitTryStatement_catchFinally() { |
| 1880 _assertClone( |
| 1881 AstFactory.tryStatement3( |
| 1882 AstFactory.block(), |
| 1883 [AstFactory.catchClause3(AstFactory.typeName4("E"))], |
| 1884 AstFactory.block())); |
| 1885 } |
| 1886 |
| 1870 void test_visitTryStatement_finally() { | 1887 void test_visitTryStatement_finally() { |
| 1871 _assertClone( | 1888 _assertClone( |
| 1872 AstFactory.tryStatement(AstFactory.block(), AstFactory.block())); | 1889 AstFactory.tryStatement(AstFactory.block(), AstFactory.block())); |
| 1873 } | 1890 } |
| 1874 | 1891 |
| 1875 void test_visitTypeArgumentList_multiple() { | 1892 void test_visitTypeArgumentList_multiple() { |
| 1876 _assertClone( | 1893 _assertClone( |
| 1877 AstFactory.typeArgumentList( | 1894 AstFactory.typeArgumentList( |
| 1878 [AstFactory.typeName4("E"), AstFactory.typeName4("F")])); | 1895 [AstFactory.typeName4("E"), AstFactory.typeName4("F")])); |
| 1879 } | 1896 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1897 } | 1914 } |
| 1898 | 1915 |
| 1899 void test_visitTypeName_noArgs() { | 1916 void test_visitTypeName_noArgs() { |
| 1900 _assertClone(AstFactory.typeName4("C")); | 1917 _assertClone(AstFactory.typeName4("C")); |
| 1901 } | 1918 } |
| 1902 | 1919 |
| 1903 void test_visitTypeName_singleArg() { | 1920 void test_visitTypeName_singleArg() { |
| 1904 _assertClone(AstFactory.typeName4("C", [AstFactory.typeName4("D")])); | 1921 _assertClone(AstFactory.typeName4("C", [AstFactory.typeName4("D")])); |
| 1905 } | 1922 } |
| 1906 | 1923 |
| 1907 void test_visitTypeParameterList_multiple() { | |
| 1908 _assertClone(AstFactory.typeParameterList(["E", "F"])); | |
| 1909 } | |
| 1910 | |
| 1911 void test_visitTypeParameterList_single() { | |
| 1912 _assertClone(AstFactory.typeParameterList(["E"])); | |
| 1913 } | |
| 1914 | |
| 1915 void test_visitTypeParameter_withExtends() { | 1924 void test_visitTypeParameter_withExtends() { |
| 1916 _assertClone(AstFactory.typeParameter2("E", AstFactory.typeName4("C"))); | 1925 _assertClone(AstFactory.typeParameter2("E", AstFactory.typeName4("C"))); |
| 1917 } | 1926 } |
| 1918 | 1927 |
| 1919 void test_visitTypeParameter_withMetadata() { | 1928 void test_visitTypeParameter_withMetadata() { |
| 1920 TypeParameter parameter = AstFactory.typeParameter("E"); | 1929 TypeParameter parameter = AstFactory.typeParameter("E"); |
| 1921 parameter.metadata = | 1930 parameter.metadata = |
| 1922 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; | 1931 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; |
| 1923 _assertClone(parameter); | 1932 _assertClone(parameter); |
| 1924 } | 1933 } |
| 1925 | 1934 |
| 1926 void test_visitTypeParameter_withoutExtends() { | 1935 void test_visitTypeParameter_withoutExtends() { |
| 1927 _assertClone(AstFactory.typeParameter("E")); | 1936 _assertClone(AstFactory.typeParameter("E")); |
| 1928 } | 1937 } |
| 1929 | 1938 |
| 1939 void test_visitTypeParameterList_multiple() { |
| 1940 _assertClone(AstFactory.typeParameterList(["E", "F"])); |
| 1941 } |
| 1942 |
| 1943 void test_visitTypeParameterList_single() { |
| 1944 _assertClone(AstFactory.typeParameterList(["E"])); |
| 1945 } |
| 1946 |
| 1947 void test_visitVariableDeclaration_initialized() { |
| 1948 _assertClone( |
| 1949 AstFactory.variableDeclaration2("a", AstFactory.identifier3("b"))); |
| 1950 } |
| 1951 |
| 1952 void test_visitVariableDeclaration_uninitialized() { |
| 1953 _assertClone(AstFactory.variableDeclaration("a")); |
| 1954 } |
| 1955 |
| 1956 void test_visitVariableDeclaration_withMetadata() { |
| 1957 VariableDeclaration declaration = AstFactory.variableDeclaration("a"); |
| 1958 declaration.metadata = |
| 1959 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; |
| 1960 _assertClone(declaration); |
| 1961 } |
| 1962 |
| 1930 void test_visitVariableDeclarationList_const_type() { | 1963 void test_visitVariableDeclarationList_const_type() { |
| 1931 _assertClone( | 1964 _assertClone( |
| 1932 AstFactory.variableDeclarationList( | 1965 AstFactory.variableDeclarationList( |
| 1933 Keyword.CONST, | 1966 Keyword.CONST, |
| 1934 AstFactory.typeName4("C"), | 1967 AstFactory.typeName4("C"), |
| 1935 [AstFactory.variableDeclaration("a"), AstFactory.variableDeclaration
("b")])); | 1968 [AstFactory.variableDeclaration("a"), AstFactory.variableDeclaration
("b")])); |
| 1936 } | 1969 } |
| 1937 | 1970 |
| 1938 void test_visitVariableDeclarationList_final_noType() { | 1971 void test_visitVariableDeclarationList_final_noType() { |
| 1939 _assertClone( | 1972 _assertClone( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1968 } | 2001 } |
| 1969 | 2002 |
| 1970 void test_visitVariableDeclarationStatement() { | 2003 void test_visitVariableDeclarationStatement() { |
| 1971 _assertClone( | 2004 _assertClone( |
| 1972 AstFactory.variableDeclarationStatement( | 2005 AstFactory.variableDeclarationStatement( |
| 1973 null, | 2006 null, |
| 1974 AstFactory.typeName4("C"), | 2007 AstFactory.typeName4("C"), |
| 1975 [AstFactory.variableDeclaration("c")])); | 2008 [AstFactory.variableDeclaration("c")])); |
| 1976 } | 2009 } |
| 1977 | 2010 |
| 1978 void test_visitVariableDeclaration_initialized() { | |
| 1979 _assertClone( | |
| 1980 AstFactory.variableDeclaration2("a", AstFactory.identifier3("b"))); | |
| 1981 } | |
| 1982 | |
| 1983 void test_visitVariableDeclaration_uninitialized() { | |
| 1984 _assertClone(AstFactory.variableDeclaration("a")); | |
| 1985 } | |
| 1986 | |
| 1987 void test_visitVariableDeclaration_withMetadata() { | |
| 1988 VariableDeclaration declaration = AstFactory.variableDeclaration("a"); | |
| 1989 declaration.metadata = | |
| 1990 [AstFactory.annotation(AstFactory.identifier3("deprecated"))]; | |
| 1991 _assertClone(declaration); | |
| 1992 } | |
| 1993 | |
| 1994 void test_visitWhileStatement() { | 2011 void test_visitWhileStatement() { |
| 1995 _assertClone( | 2012 _assertClone( |
| 1996 AstFactory.whileStatement(AstFactory.identifier3("c"), AstFactory.block(
))); | 2013 AstFactory.whileStatement(AstFactory.identifier3("c"), AstFactory.block(
))); |
| 1997 } | 2014 } |
| 1998 | 2015 |
| 1999 void test_visitWithClause_multiple() { | 2016 void test_visitWithClause_multiple() { |
| 2000 _assertClone( | 2017 _assertClone( |
| 2001 AstFactory.withClause( | 2018 AstFactory.withClause( |
| 2002 [ | 2019 [ |
| 2003 AstFactory.typeName4("A"), | 2020 AstFactory.typeName4("A"), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2028 } | 2045 } |
| 2029 | 2046 |
| 2030 clone = node.accept(new AstCloner(true)); | 2047 clone = node.accept(new AstCloner(true)); |
| 2031 comparitor = new AstCloneComparator(true); | 2048 comparitor = new AstCloneComparator(true); |
| 2032 if (!comparitor.isEqualNodes(node, clone)) { | 2049 if (!comparitor.isEqualNodes(node, clone)) { |
| 2033 fail("Failed to clone ${node.runtimeType.toString()}"); | 2050 fail("Failed to clone ${node.runtimeType.toString()}"); |
| 2034 } | 2051 } |
| 2035 } | 2052 } |
| 2036 } | 2053 } |
| 2037 | 2054 |
| 2038 class AstCloneComparator extends AstComparator { | |
| 2039 final bool expectTokensCopied; | |
| 2040 | |
| 2041 AstCloneComparator(this.expectTokensCopied); | |
| 2042 | |
| 2043 @override | |
| 2044 bool isEqualNodes(AstNode first, AstNode second) { | |
| 2045 if (first != null && identical(first, second)) { | |
| 2046 fail('Failed to copy node: $first (${first.offset})'); | |
| 2047 return false; | |
| 2048 } | |
| 2049 return super.isEqualNodes(first, second); | |
| 2050 } | |
| 2051 | |
| 2052 @override | |
| 2053 bool isEqualTokens(Token first, Token second) { | |
| 2054 if (expectTokensCopied && first != null && identical(first, second)) { | |
| 2055 fail('Failed to copy token: ${first.lexeme} (${first.offset})'); | |
| 2056 return false; | |
| 2057 } | |
| 2058 return super.isEqualTokens(first, second); | |
| 2059 } | |
| 2060 } | |
| 2061 | |
| 2062 class BooleanArrayTest { | 2055 class BooleanArrayTest { |
| 2063 void test_get_negative() { | 2056 void test_get_negative() { |
| 2064 try { | 2057 try { |
| 2065 BooleanArray.get(0, -1); | 2058 BooleanArray.get(0, -1); |
| 2066 fail("Expected "); | 2059 fail("Expected "); |
| 2067 } on RangeError catch (exception) { | 2060 } on RangeError catch (exception) { |
| 2068 // Expected | 2061 // Expected |
| 2069 } | 2062 } |
| 2070 } | 2063 } |
| 2071 | 2064 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 expect(topologicalSort[1], unorderedEquals([node1, node2])); | 2374 expect(topologicalSort[1], unorderedEquals([node1, node2])); |
| 2382 } | 2375 } |
| 2383 } | 2376 } |
| 2384 | 2377 |
| 2385 /** | 2378 /** |
| 2386 * Instances of the class `Node` represent simple nodes used for testing purpose
s. | 2379 * Instances of the class `Node` represent simple nodes used for testing purpose
s. |
| 2387 */ | 2380 */ |
| 2388 class DirectedGraphTest_Node { | 2381 class DirectedGraphTest_Node { |
| 2389 } | 2382 } |
| 2390 | 2383 |
| 2391 class Getter_NodeReplacerTest_testAnnotatedNode implements | |
| 2392 NodeReplacerTest_Getter { | |
| 2393 @override | |
| 2394 Comment get(AnnotatedNode node) => node.documentationComment; | |
| 2395 } | |
| 2396 | |
| 2397 class Getter_NodeReplacerTest_testNormalFormalParameter implements | |
| 2398 NodeReplacerTest_Getter { | |
| 2399 @override | |
| 2400 SimpleIdentifier get(NormalFormalParameter node) => node.identifier; | |
| 2401 } | |
| 2402 | |
| 2403 class Getter_NodeReplacerTest_testNormalFormalParameter_2 implements | |
| 2404 NodeReplacerTest_Getter { | |
| 2405 @override | |
| 2406 Comment get(NormalFormalParameter node) => node.documentationComment; | |
| 2407 } | |
| 2408 | |
| 2409 class Getter_NodeReplacerTest_testTypedLiteral implements | |
| 2410 NodeReplacerTest_Getter { | |
| 2411 @override | |
| 2412 TypeArgumentList get(TypedLiteral node) => node.typeArguments; | |
| 2413 } | |
| 2414 | |
| 2415 class Getter_NodeReplacerTest_testUriBasedDirective implements | |
| 2416 NodeReplacerTest_Getter { | |
| 2417 @override | |
| 2418 StringLiteral get(UriBasedDirective node) => node.uri; | |
| 2419 } | |
| 2420 | |
| 2421 class Getter_NodeReplacerTest_test_annotation implements NodeReplacerTest_Getter | 2384 class Getter_NodeReplacerTest_test_annotation implements NodeReplacerTest_Getter |
| 2422 { | 2385 { |
| 2423 @override | 2386 @override |
| 2424 ArgumentList get(Annotation node) => node.arguments; | 2387 ArgumentList get(Annotation node) => node.arguments; |
| 2425 } | 2388 } |
| 2426 | 2389 |
| 2427 class Getter_NodeReplacerTest_test_annotation_2 implements | 2390 class Getter_NodeReplacerTest_test_annotation_2 implements |
| 2428 NodeReplacerTest_Getter { | 2391 NodeReplacerTest_Getter { |
| 2429 @override | 2392 @override |
| 2430 Identifier get(Annotation node) => node.name; | 2393 Identifier get(Annotation node) => node.name; |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2826 @override | 2789 @override |
| 2827 Expression get(ForStatement node) => node.condition; | 2790 Expression get(ForStatement node) => node.condition; |
| 2828 } | 2791 } |
| 2829 | 2792 |
| 2830 class Getter_NodeReplacerTest_test_functionDeclaration implements | 2793 class Getter_NodeReplacerTest_test_functionDeclaration implements |
| 2831 NodeReplacerTest_Getter { | 2794 NodeReplacerTest_Getter { |
| 2832 @override | 2795 @override |
| 2833 TypeName get(FunctionDeclaration node) => node.returnType; | 2796 TypeName get(FunctionDeclaration node) => node.returnType; |
| 2834 } | 2797 } |
| 2835 | 2798 |
| 2836 class Getter_NodeReplacerTest_test_functionDeclarationStatement implements | |
| 2837 NodeReplacerTest_Getter { | |
| 2838 @override | |
| 2839 FunctionDeclaration get(FunctionDeclarationStatement node) => | |
| 2840 node.functionDeclaration; | |
| 2841 } | |
| 2842 | |
| 2843 class Getter_NodeReplacerTest_test_functionDeclaration_2 implements | 2799 class Getter_NodeReplacerTest_test_functionDeclaration_2 implements |
| 2844 NodeReplacerTest_Getter { | 2800 NodeReplacerTest_Getter { |
| 2845 @override | 2801 @override |
| 2846 FunctionExpression get(FunctionDeclaration node) => node.functionExpression; | 2802 FunctionExpression get(FunctionDeclaration node) => node.functionExpression; |
| 2847 } | 2803 } |
| 2848 | 2804 |
| 2849 class Getter_NodeReplacerTest_test_functionDeclaration_3 implements | 2805 class Getter_NodeReplacerTest_test_functionDeclaration_3 implements |
| 2850 NodeReplacerTest_Getter { | 2806 NodeReplacerTest_Getter { |
| 2851 @override | 2807 @override |
| 2852 SimpleIdentifier get(FunctionDeclaration node) => node.name; | 2808 SimpleIdentifier get(FunctionDeclaration node) => node.name; |
| 2853 } | 2809 } |
| 2854 | 2810 |
| 2811 class Getter_NodeReplacerTest_test_functionDeclarationStatement implements |
| 2812 NodeReplacerTest_Getter { |
| 2813 @override |
| 2814 FunctionDeclaration get(FunctionDeclarationStatement node) => |
| 2815 node.functionDeclaration; |
| 2816 } |
| 2817 |
| 2855 class Getter_NodeReplacerTest_test_functionExpression implements | 2818 class Getter_NodeReplacerTest_test_functionExpression implements |
| 2856 NodeReplacerTest_Getter { | 2819 NodeReplacerTest_Getter { |
| 2857 @override | 2820 @override |
| 2858 FormalParameterList get(FunctionExpression node) => node.parameters; | 2821 FormalParameterList get(FunctionExpression node) => node.parameters; |
| 2859 } | 2822 } |
| 2860 | 2823 |
| 2824 class Getter_NodeReplacerTest_test_functionExpression_2 implements |
| 2825 NodeReplacerTest_Getter { |
| 2826 @override |
| 2827 FunctionBody get(FunctionExpression node) => node.body; |
| 2828 } |
| 2829 |
| 2861 class Getter_NodeReplacerTest_test_functionExpressionInvocation implements | 2830 class Getter_NodeReplacerTest_test_functionExpressionInvocation implements |
| 2862 NodeReplacerTest_Getter { | 2831 NodeReplacerTest_Getter { |
| 2863 @override | 2832 @override |
| 2864 Expression get(FunctionExpressionInvocation node) => node.function; | 2833 Expression get(FunctionExpressionInvocation node) => node.function; |
| 2865 } | 2834 } |
| 2866 | 2835 |
| 2867 class Getter_NodeReplacerTest_test_functionExpressionInvocation_2 implements | 2836 class Getter_NodeReplacerTest_test_functionExpressionInvocation_2 implements |
| 2868 NodeReplacerTest_Getter { | 2837 NodeReplacerTest_Getter { |
| 2869 @override | 2838 @override |
| 2870 ArgumentList get(FunctionExpressionInvocation node) => node.argumentList; | 2839 ArgumentList get(FunctionExpressionInvocation node) => node.argumentList; |
| 2871 } | 2840 } |
| 2872 | 2841 |
| 2873 class Getter_NodeReplacerTest_test_functionExpression_2 implements | |
| 2874 NodeReplacerTest_Getter { | |
| 2875 @override | |
| 2876 FunctionBody get(FunctionExpression node) => node.body; | |
| 2877 } | |
| 2878 | |
| 2879 class Getter_NodeReplacerTest_test_functionTypeAlias implements | 2842 class Getter_NodeReplacerTest_test_functionTypeAlias implements |
| 2880 NodeReplacerTest_Getter { | 2843 NodeReplacerTest_Getter { |
| 2881 @override | 2844 @override |
| 2882 TypeParameterList get(FunctionTypeAlias node) => node.typeParameters; | 2845 TypeParameterList get(FunctionTypeAlias node) => node.typeParameters; |
| 2883 } | 2846 } |
| 2884 | 2847 |
| 2885 class Getter_NodeReplacerTest_test_functionTypeAlias_2 implements | 2848 class Getter_NodeReplacerTest_test_functionTypeAlias_2 implements |
| 2886 NodeReplacerTest_Getter { | 2849 NodeReplacerTest_Getter { |
| 2887 @override | 2850 @override |
| 2888 FormalParameterList get(FunctionTypeAlias node) => node.parameters; | 2851 FormalParameterList get(FunctionTypeAlias node) => node.parameters; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 @override | 3047 @override |
| 3085 LibraryIdentifier get(PartOfDirective node) => node.libraryName; | 3048 LibraryIdentifier get(PartOfDirective node) => node.libraryName; |
| 3086 } | 3049 } |
| 3087 | 3050 |
| 3088 class Getter_NodeReplacerTest_test_postfixExpression implements | 3051 class Getter_NodeReplacerTest_test_postfixExpression implements |
| 3089 NodeReplacerTest_Getter { | 3052 NodeReplacerTest_Getter { |
| 3090 @override | 3053 @override |
| 3091 Expression get(PostfixExpression node) => node.operand; | 3054 Expression get(PostfixExpression node) => node.operand; |
| 3092 } | 3055 } |
| 3093 | 3056 |
| 3094 class Getter_NodeReplacerTest_test_prefixExpression implements | |
| 3095 NodeReplacerTest_Getter { | |
| 3096 @override | |
| 3097 Expression get(PrefixExpression node) => node.operand; | |
| 3098 } | |
| 3099 | |
| 3100 class Getter_NodeReplacerTest_test_prefixedIdentifier implements | 3057 class Getter_NodeReplacerTest_test_prefixedIdentifier implements |
| 3101 NodeReplacerTest_Getter { | 3058 NodeReplacerTest_Getter { |
| 3102 @override | 3059 @override |
| 3103 SimpleIdentifier get(PrefixedIdentifier node) => node.identifier; | 3060 SimpleIdentifier get(PrefixedIdentifier node) => node.identifier; |
| 3104 } | 3061 } |
| 3105 | 3062 |
| 3106 class Getter_NodeReplacerTest_test_prefixedIdentifier_2 implements | 3063 class Getter_NodeReplacerTest_test_prefixedIdentifier_2 implements |
| 3107 NodeReplacerTest_Getter { | 3064 NodeReplacerTest_Getter { |
| 3108 @override | 3065 @override |
| 3109 SimpleIdentifier get(PrefixedIdentifier node) => node.prefix; | 3066 SimpleIdentifier get(PrefixedIdentifier node) => node.prefix; |
| 3110 } | 3067 } |
| 3111 | 3068 |
| 3069 class Getter_NodeReplacerTest_test_prefixExpression implements |
| 3070 NodeReplacerTest_Getter { |
| 3071 @override |
| 3072 Expression get(PrefixExpression node) => node.operand; |
| 3073 } |
| 3074 |
| 3112 class Getter_NodeReplacerTest_test_propertyAccess implements | 3075 class Getter_NodeReplacerTest_test_propertyAccess implements |
| 3113 NodeReplacerTest_Getter { | 3076 NodeReplacerTest_Getter { |
| 3114 @override | 3077 @override |
| 3115 Expression get(PropertyAccess node) => node.target; | 3078 Expression get(PropertyAccess node) => node.target; |
| 3116 } | 3079 } |
| 3117 | 3080 |
| 3118 class Getter_NodeReplacerTest_test_propertyAccess_2 implements | 3081 class Getter_NodeReplacerTest_test_propertyAccess_2 implements |
| 3119 NodeReplacerTest_Getter { | 3082 NodeReplacerTest_Getter { |
| 3120 @override | 3083 @override |
| 3121 SimpleIdentifier get(PropertyAccess node) => node.propertyName; | 3084 SimpleIdentifier get(PropertyAccess node) => node.propertyName; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3217 @override | 3180 @override |
| 3218 SimpleIdentifier get(TypeParameter node) => node.name; | 3181 SimpleIdentifier get(TypeParameter node) => node.name; |
| 3219 } | 3182 } |
| 3220 | 3183 |
| 3221 class Getter_NodeReplacerTest_test_variableDeclaration implements | 3184 class Getter_NodeReplacerTest_test_variableDeclaration implements |
| 3222 NodeReplacerTest_Getter { | 3185 NodeReplacerTest_Getter { |
| 3223 @override | 3186 @override |
| 3224 SimpleIdentifier get(VariableDeclaration node) => node.name; | 3187 SimpleIdentifier get(VariableDeclaration node) => node.name; |
| 3225 } | 3188 } |
| 3226 | 3189 |
| 3190 class Getter_NodeReplacerTest_test_variableDeclaration_2 implements |
| 3191 NodeReplacerTest_Getter { |
| 3192 @override |
| 3193 Expression get(VariableDeclaration node) => node.initializer; |
| 3194 } |
| 3195 |
| 3227 class Getter_NodeReplacerTest_test_variableDeclarationList implements | 3196 class Getter_NodeReplacerTest_test_variableDeclarationList implements |
| 3228 NodeReplacerTest_Getter { | 3197 NodeReplacerTest_Getter { |
| 3229 @override | 3198 @override |
| 3230 TypeName get(VariableDeclarationList node) => node.type; | 3199 TypeName get(VariableDeclarationList node) => node.type; |
| 3231 } | 3200 } |
| 3232 | 3201 |
| 3233 class Getter_NodeReplacerTest_test_variableDeclarationStatement implements | 3202 class Getter_NodeReplacerTest_test_variableDeclarationStatement implements |
| 3234 NodeReplacerTest_Getter { | 3203 NodeReplacerTest_Getter { |
| 3235 @override | 3204 @override |
| 3236 VariableDeclarationList get(VariableDeclarationStatement node) => | 3205 VariableDeclarationList get(VariableDeclarationStatement node) => |
| 3237 node.variables; | 3206 node.variables; |
| 3238 } | 3207 } |
| 3239 | 3208 |
| 3240 class Getter_NodeReplacerTest_test_variableDeclaration_2 implements | |
| 3241 NodeReplacerTest_Getter { | |
| 3242 @override | |
| 3243 Expression get(VariableDeclaration node) => node.initializer; | |
| 3244 } | |
| 3245 | |
| 3246 class Getter_NodeReplacerTest_test_whileStatement implements | 3209 class Getter_NodeReplacerTest_test_whileStatement implements |
| 3247 NodeReplacerTest_Getter { | 3210 NodeReplacerTest_Getter { |
| 3248 @override | 3211 @override |
| 3249 Expression get(WhileStatement node) => node.condition; | 3212 Expression get(WhileStatement node) => node.condition; |
| 3250 } | 3213 } |
| 3251 | 3214 |
| 3252 class Getter_NodeReplacerTest_test_whileStatement_2 implements | 3215 class Getter_NodeReplacerTest_test_whileStatement_2 implements |
| 3253 NodeReplacerTest_Getter { | 3216 NodeReplacerTest_Getter { |
| 3254 @override | 3217 @override |
| 3255 Statement get(WhileStatement node) => node.body; | 3218 Statement get(WhileStatement node) => node.body; |
| 3256 } | 3219 } |
| 3257 | 3220 |
| 3221 class Getter_NodeReplacerTest_testAnnotatedNode implements |
| 3222 NodeReplacerTest_Getter { |
| 3223 @override |
| 3224 Comment get(AnnotatedNode node) => node.documentationComment; |
| 3225 } |
| 3226 |
| 3227 class Getter_NodeReplacerTest_testNormalFormalParameter implements |
| 3228 NodeReplacerTest_Getter { |
| 3229 @override |
| 3230 SimpleIdentifier get(NormalFormalParameter node) => node.identifier; |
| 3231 } |
| 3232 |
| 3233 class Getter_NodeReplacerTest_testNormalFormalParameter_2 implements |
| 3234 NodeReplacerTest_Getter { |
| 3235 @override |
| 3236 Comment get(NormalFormalParameter node) => node.documentationComment; |
| 3237 } |
| 3238 |
| 3239 class Getter_NodeReplacerTest_testTypedLiteral implements |
| 3240 NodeReplacerTest_Getter { |
| 3241 @override |
| 3242 TypeArgumentList get(TypedLiteral node) => node.typeArguments; |
| 3243 } |
| 3244 |
| 3245 class Getter_NodeReplacerTest_testUriBasedDirective implements |
| 3246 NodeReplacerTest_Getter { |
| 3247 @override |
| 3248 StringLiteral get(UriBasedDirective node) => node.uri; |
| 3249 } |
| 3250 |
| 3258 class LineInfoTest { | 3251 class LineInfoTest { |
| 3259 void test_creation() { | 3252 void test_creation() { |
| 3260 expect(new LineInfo(<int>[0]), isNotNull); | 3253 expect(new LineInfo(<int>[0]), isNotNull); |
| 3261 } | 3254 } |
| 3262 | 3255 |
| 3263 void test_creation_empty() { | 3256 void test_creation_empty() { |
| 3264 try { | 3257 try { |
| 3265 new LineInfo(<int>[]); | 3258 new LineInfo(<int>[]); |
| 3266 fail("Expected IllegalArgumentException"); | 3259 fail("Expected IllegalArgumentException"); |
| 3267 } on IllegalArgumentException catch (exception) { | 3260 } on IllegalArgumentException catch (exception) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3293 } | 3286 } |
| 3294 | 3287 |
| 3295 void test_middleLine() { | 3288 void test_middleLine() { |
| 3296 LineInfo info = new LineInfo(<int>[0, 12, 34]); | 3289 LineInfo info = new LineInfo(<int>[0, 12, 34]); |
| 3297 LineInfo_Location location = info.getLocation(12); | 3290 LineInfo_Location location = info.getLocation(12); |
| 3298 expect(location.lineNumber, 2); | 3291 expect(location.lineNumber, 2); |
| 3299 expect(location.columnNumber, 1); | 3292 expect(location.columnNumber, 1); |
| 3300 } | 3293 } |
| 3301 } | 3294 } |
| 3302 | 3295 |
| 3303 class ListGetter_NodeReplacerTest_testAnnotatedNode extends | |
| 3304 NodeReplacerTest_ListGetter<AnnotatedNode, Annotation> { | |
| 3305 ListGetter_NodeReplacerTest_testAnnotatedNode(int arg0) : super(arg0); | |
| 3306 | |
| 3307 @override | |
| 3308 NodeList<Annotation> getList(AnnotatedNode node) => node.metadata; | |
| 3309 } | |
| 3310 | |
| 3311 class ListGetter_NodeReplacerTest_testNamespaceDirective extends | |
| 3312 NodeReplacerTest_ListGetter<NamespaceDirective, Combinator> { | |
| 3313 ListGetter_NodeReplacerTest_testNamespaceDirective(int arg0) : super(arg0); | |
| 3314 | |
| 3315 @override | |
| 3316 NodeList<Combinator> getList(NamespaceDirective node) => node.combinators; | |
| 3317 } | |
| 3318 | |
| 3319 class ListGetter_NodeReplacerTest_testNormalFormalParameter extends | |
| 3320 NodeReplacerTest_ListGetter<NormalFormalParameter, Annotation> { | |
| 3321 ListGetter_NodeReplacerTest_testNormalFormalParameter(int arg0) : super(arg0); | |
| 3322 | |
| 3323 @override | |
| 3324 NodeList<Annotation> getList(NormalFormalParameter node) => node.metadata; | |
| 3325 } | |
| 3326 | |
| 3327 class ListGetter_NodeReplacerTest_testSwitchMember extends | |
| 3328 NodeReplacerTest_ListGetter<SwitchMember, Label> { | |
| 3329 ListGetter_NodeReplacerTest_testSwitchMember(int arg0) : super(arg0); | |
| 3330 | |
| 3331 @override | |
| 3332 NodeList<Label> getList(SwitchMember node) => node.labels; | |
| 3333 } | |
| 3334 | |
| 3335 class ListGetter_NodeReplacerTest_testSwitchMember_2 extends | |
| 3336 NodeReplacerTest_ListGetter<SwitchMember, Statement> { | |
| 3337 ListGetter_NodeReplacerTest_testSwitchMember_2(int arg0) : super(arg0); | |
| 3338 | |
| 3339 @override | |
| 3340 NodeList<Statement> getList(SwitchMember node) => node.statements; | |
| 3341 } | |
| 3342 | |
| 3343 class ListGetter_NodeReplacerTest_test_adjacentStrings extends | 3296 class ListGetter_NodeReplacerTest_test_adjacentStrings extends |
| 3344 NodeReplacerTest_ListGetter<AdjacentStrings, StringLiteral> { | 3297 NodeReplacerTest_ListGetter<AdjacentStrings, StringLiteral> { |
| 3345 ListGetter_NodeReplacerTest_test_adjacentStrings(int arg0) : super(arg0); | 3298 ListGetter_NodeReplacerTest_test_adjacentStrings(int arg0) : super(arg0); |
| 3346 | 3299 |
| 3347 @override | 3300 @override |
| 3348 NodeList<StringLiteral> getList(AdjacentStrings node) => node.strings; | 3301 NodeList<StringLiteral> getList(AdjacentStrings node) => node.strings; |
| 3349 } | 3302 } |
| 3350 | 3303 |
| 3351 class ListGetter_NodeReplacerTest_test_adjacentStrings_2 extends | 3304 class ListGetter_NodeReplacerTest_test_adjacentStrings_2 extends |
| 3352 NodeReplacerTest_ListGetter<AdjacentStrings, StringLiteral> { | 3305 NodeReplacerTest_ListGetter<AdjacentStrings, StringLiteral> { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3416 class ListGetter_NodeReplacerTest_test_constructorDeclaration extends | 3369 class ListGetter_NodeReplacerTest_test_constructorDeclaration extends |
| 3417 NodeReplacerTest_ListGetter<ConstructorDeclaration, ConstructorInitializer>
{ | 3370 NodeReplacerTest_ListGetter<ConstructorDeclaration, ConstructorInitializer>
{ |
| 3418 ListGetter_NodeReplacerTest_test_constructorDeclaration(int arg0) | 3371 ListGetter_NodeReplacerTest_test_constructorDeclaration(int arg0) |
| 3419 : super(arg0); | 3372 : super(arg0); |
| 3420 | 3373 |
| 3421 @override | 3374 @override |
| 3422 NodeList<ConstructorInitializer> getList(ConstructorDeclaration node) => | 3375 NodeList<ConstructorInitializer> getList(ConstructorDeclaration node) => |
| 3423 node.initializers; | 3376 node.initializers; |
| 3424 } | 3377 } |
| 3425 | 3378 |
| 3379 class ListGetter_NodeReplacerTest_test_formalParameterList extends |
| 3380 NodeReplacerTest_ListGetter<FormalParameterList, FormalParameter> { |
| 3381 ListGetter_NodeReplacerTest_test_formalParameterList(int arg0) : super(arg0); |
| 3382 |
| 3383 @override |
| 3384 NodeList<FormalParameter> getList(FormalParameterList node) => |
| 3385 node.parameters; |
| 3386 } |
| 3387 |
| 3426 class ListGetter_NodeReplacerTest_test_forStatement_withInitialization extends | 3388 class ListGetter_NodeReplacerTest_test_forStatement_withInitialization extends |
| 3427 NodeReplacerTest_ListGetter<ForStatement, Expression> { | 3389 NodeReplacerTest_ListGetter<ForStatement, Expression> { |
| 3428 ListGetter_NodeReplacerTest_test_forStatement_withInitialization(int arg0) | 3390 ListGetter_NodeReplacerTest_test_forStatement_withInitialization(int arg0) |
| 3429 : super(arg0); | 3391 : super(arg0); |
| 3430 | 3392 |
| 3431 @override | 3393 @override |
| 3432 NodeList<Expression> getList(ForStatement node) => node.updaters; | 3394 NodeList<Expression> getList(ForStatement node) => node.updaters; |
| 3433 } | 3395 } |
| 3434 | 3396 |
| 3435 class ListGetter_NodeReplacerTest_test_forStatement_withVariables extends | 3397 class ListGetter_NodeReplacerTest_test_forStatement_withVariables extends |
| 3436 NodeReplacerTest_ListGetter<ForStatement, Expression> { | 3398 NodeReplacerTest_ListGetter<ForStatement, Expression> { |
| 3437 ListGetter_NodeReplacerTest_test_forStatement_withVariables(int arg0) | 3399 ListGetter_NodeReplacerTest_test_forStatement_withVariables(int arg0) |
| 3438 : super(arg0); | 3400 : super(arg0); |
| 3439 | 3401 |
| 3440 @override | 3402 @override |
| 3441 NodeList<Expression> getList(ForStatement node) => node.updaters; | 3403 NodeList<Expression> getList(ForStatement node) => node.updaters; |
| 3442 } | 3404 } |
| 3443 | 3405 |
| 3444 class ListGetter_NodeReplacerTest_test_formalParameterList extends | |
| 3445 NodeReplacerTest_ListGetter<FormalParameterList, FormalParameter> { | |
| 3446 ListGetter_NodeReplacerTest_test_formalParameterList(int arg0) : super(arg0); | |
| 3447 | |
| 3448 @override | |
| 3449 NodeList<FormalParameter> getList(FormalParameterList node) => | |
| 3450 node.parameters; | |
| 3451 } | |
| 3452 | |
| 3453 class ListGetter_NodeReplacerTest_test_hideCombinator extends | 3406 class ListGetter_NodeReplacerTest_test_hideCombinator extends |
| 3454 NodeReplacerTest_ListGetter<HideCombinator, SimpleIdentifier> { | 3407 NodeReplacerTest_ListGetter<HideCombinator, SimpleIdentifier> { |
| 3455 ListGetter_NodeReplacerTest_test_hideCombinator(int arg0) : super(arg0); | 3408 ListGetter_NodeReplacerTest_test_hideCombinator(int arg0) : super(arg0); |
| 3456 | 3409 |
| 3457 @override | 3410 @override |
| 3458 NodeList<SimpleIdentifier> getList(HideCombinator node) => node.hiddenNames; | 3411 NodeList<SimpleIdentifier> getList(HideCombinator node) => node.hiddenNames; |
| 3459 } | 3412 } |
| 3460 | 3413 |
| 3461 class ListGetter_NodeReplacerTest_test_implementsClause extends | 3414 class ListGetter_NodeReplacerTest_test_implementsClause extends |
| 3462 NodeReplacerTest_ListGetter<ImplementsClause, TypeName> { | 3415 NodeReplacerTest_ListGetter<ImplementsClause, TypeName> { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3559 } | 3512 } |
| 3560 | 3513 |
| 3561 class ListGetter_NodeReplacerTest_test_withClause extends | 3514 class ListGetter_NodeReplacerTest_test_withClause extends |
| 3562 NodeReplacerTest_ListGetter<WithClause, TypeName> { | 3515 NodeReplacerTest_ListGetter<WithClause, TypeName> { |
| 3563 ListGetter_NodeReplacerTest_test_withClause(int arg0) : super(arg0); | 3516 ListGetter_NodeReplacerTest_test_withClause(int arg0) : super(arg0); |
| 3564 | 3517 |
| 3565 @override | 3518 @override |
| 3566 NodeList<TypeName> getList(WithClause node) => node.mixinTypes; | 3519 NodeList<TypeName> getList(WithClause node) => node.mixinTypes; |
| 3567 } | 3520 } |
| 3568 | 3521 |
| 3522 class ListGetter_NodeReplacerTest_testAnnotatedNode extends |
| 3523 NodeReplacerTest_ListGetter<AnnotatedNode, Annotation> { |
| 3524 ListGetter_NodeReplacerTest_testAnnotatedNode(int arg0) : super(arg0); |
| 3525 |
| 3526 @override |
| 3527 NodeList<Annotation> getList(AnnotatedNode node) => node.metadata; |
| 3528 } |
| 3529 |
| 3530 class ListGetter_NodeReplacerTest_testNamespaceDirective extends |
| 3531 NodeReplacerTest_ListGetter<NamespaceDirective, Combinator> { |
| 3532 ListGetter_NodeReplacerTest_testNamespaceDirective(int arg0) : super(arg0); |
| 3533 |
| 3534 @override |
| 3535 NodeList<Combinator> getList(NamespaceDirective node) => node.combinators; |
| 3536 } |
| 3537 |
| 3538 class ListGetter_NodeReplacerTest_testNormalFormalParameter extends |
| 3539 NodeReplacerTest_ListGetter<NormalFormalParameter, Annotation> { |
| 3540 ListGetter_NodeReplacerTest_testNormalFormalParameter(int arg0) : super(arg0); |
| 3541 |
| 3542 @override |
| 3543 NodeList<Annotation> getList(NormalFormalParameter node) => node.metadata; |
| 3544 } |
| 3545 |
| 3546 class ListGetter_NodeReplacerTest_testSwitchMember extends |
| 3547 NodeReplacerTest_ListGetter<SwitchMember, Label> { |
| 3548 ListGetter_NodeReplacerTest_testSwitchMember(int arg0) : super(arg0); |
| 3549 |
| 3550 @override |
| 3551 NodeList<Label> getList(SwitchMember node) => node.labels; |
| 3552 } |
| 3553 |
| 3554 class ListGetter_NodeReplacerTest_testSwitchMember_2 extends |
| 3555 NodeReplacerTest_ListGetter<SwitchMember, Statement> { |
| 3556 ListGetter_NodeReplacerTest_testSwitchMember_2(int arg0) : super(arg0); |
| 3557 |
| 3558 @override |
| 3559 NodeList<Statement> getList(SwitchMember node) => node.statements; |
| 3560 } |
| 3561 |
| 3569 class ListUtilitiesTest { | 3562 class ListUtilitiesTest { |
| 3570 void test_addAll_emptyToEmpty() { | 3563 void test_addAll_emptyToEmpty() { |
| 3571 List<String> list = new List<String>(); | 3564 List<String> list = new List<String>(); |
| 3572 List<String> elements = <String>[]; | 3565 List<String> elements = <String>[]; |
| 3573 ListUtilities.addAll(list, elements); | 3566 ListUtilities.addAll(list, elements); |
| 3574 expect(list.length, 0); | 3567 expect(list.length, 0); |
| 3575 } | 3568 } |
| 3576 | 3569 |
| 3577 void test_addAll_emptyToNonEmpty() { | 3570 void test_addAll_emptyToNonEmpty() { |
| 3578 List<String> list = new List<String>(); | 3571 List<String> list = new List<String>(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 } | 3736 } |
| 3744 | 3737 |
| 3745 void test_argumentList() { | 3738 void test_argumentList() { |
| 3746 ArgumentList node = AstFactory.argumentList([AstFactory.integer(0)]); | 3739 ArgumentList node = AstFactory.argumentList([AstFactory.integer(0)]); |
| 3747 _assertReplace(node, new ListGetter_NodeReplacerTest_test_argumentList(0)); | 3740 _assertReplace(node, new ListGetter_NodeReplacerTest_test_argumentList(0)); |
| 3748 } | 3741 } |
| 3749 | 3742 |
| 3750 void test_asExpression() { | 3743 void test_asExpression() { |
| 3751 AsExpression node = AstFactory.asExpression( | 3744 AsExpression node = AstFactory.asExpression( |
| 3752 AstFactory.integer(0), | 3745 AstFactory.integer(0), |
| 3753 AstFactory.typeName3( | 3746 AstFactory.typeName3(AstFactory.identifier3("a"), [AstFactory.typeName4(
"C")])); |
| 3754 AstFactory.identifier3("a"), | |
| 3755 [AstFactory.typeName4("C")])); | |
| 3756 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression_2()); | 3747 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression_2()); |
| 3757 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression()); | 3748 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression()); |
| 3758 } | 3749 } |
| 3759 | 3750 |
| 3760 void test_assertStatement() { | 3751 void test_assertStatement() { |
| 3761 AssertStatement node = | 3752 AssertStatement node = |
| 3762 AstFactory.assertStatement(AstFactory.booleanLiteral(true)); | 3753 AstFactory.assertStatement(AstFactory.booleanLiteral(true)); |
| 3763 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement()); | 3754 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement()); |
| 3764 } | 3755 } |
| 3765 | 3756 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3879 void test_commentReference() { | 3870 void test_commentReference() { |
| 3880 CommentReference node = | 3871 CommentReference node = |
| 3881 new CommentReference(null, AstFactory.identifier3("x")); | 3872 new CommentReference(null, AstFactory.identifier3("x")); |
| 3882 _assertReplace(node, new Getter_NodeReplacerTest_test_commentReference()); | 3873 _assertReplace(node, new Getter_NodeReplacerTest_test_commentReference()); |
| 3883 } | 3874 } |
| 3884 | 3875 |
| 3885 void test_compilationUnit() { | 3876 void test_compilationUnit() { |
| 3886 CompilationUnit node = AstFactory.compilationUnit8( | 3877 CompilationUnit node = AstFactory.compilationUnit8( |
| 3887 "", | 3878 "", |
| 3888 [AstFactory.libraryDirective2("lib")], | 3879 [AstFactory.libraryDirective2("lib")], |
| 3889 [AstFactory.topLevelVariableDeclaration2( | 3880 [ |
| 3890 null, | 3881 AstFactory.topLevelVariableDeclaration2( |
| 3891 [AstFactory.variableDeclaration("X")])]); | 3882 null, |
| 3883 [AstFactory.variableDeclaration("X")])]); |
| 3892 _assertReplace(node, new Getter_NodeReplacerTest_test_compilationUnit()); | 3884 _assertReplace(node, new Getter_NodeReplacerTest_test_compilationUnit()); |
| 3893 _assertReplace( | 3885 _assertReplace( |
| 3894 node, | 3886 node, |
| 3895 new ListGetter_NodeReplacerTest_test_compilationUnit(0)); | 3887 new ListGetter_NodeReplacerTest_test_compilationUnit(0)); |
| 3896 _assertReplace( | 3888 _assertReplace( |
| 3897 node, | 3889 node, |
| 3898 new ListGetter_NodeReplacerTest_test_compilationUnit_2(0)); | 3890 new ListGetter_NodeReplacerTest_test_compilationUnit_2(0)); |
| 3899 } | 3891 } |
| 3900 | 3892 |
| 3901 void test_conditionalExpression() { | 3893 void test_conditionalExpression() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3918 ConstructorDeclaration node = AstFactory.constructorDeclaration2( | 3910 ConstructorDeclaration node = AstFactory.constructorDeclaration2( |
| 3919 null, | 3911 null, |
| 3920 null, | 3912 null, |
| 3921 AstFactory.identifier3("C"), | 3913 AstFactory.identifier3("C"), |
| 3922 "d", | 3914 "d", |
| 3923 AstFactory.formalParameterList(), | 3915 AstFactory.formalParameterList(), |
| 3924 [AstFactory.constructorFieldInitializer(false, "x", AstFactory.integer(0
))], | 3916 [AstFactory.constructorFieldInitializer(false, "x", AstFactory.integer(0
))], |
| 3925 AstFactory.emptyFunctionBody()); | 3917 AstFactory.emptyFunctionBody()); |
| 3926 node.documentationComment = | 3918 node.documentationComment = |
| 3927 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3919 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| 3928 node.metadata = | 3920 node.metadata = [AstFactory.annotation(AstFactory.identifier3("a"))]; |
| 3929 [AstFactory.annotation(AstFactory.identifier3("a"))]; | |
| 3930 node.redirectedConstructor = | 3921 node.redirectedConstructor = |
| 3931 AstFactory.constructorName(AstFactory.typeName4("B"), "a"); | 3922 AstFactory.constructorName(AstFactory.typeName4("B"), "a"); |
| 3932 _assertReplace( | 3923 _assertReplace( |
| 3933 node, | 3924 node, |
| 3934 new Getter_NodeReplacerTest_test_constructorDeclaration_3()); | 3925 new Getter_NodeReplacerTest_test_constructorDeclaration_3()); |
| 3935 _assertReplace( | 3926 _assertReplace( |
| 3936 node, | 3927 node, |
| 3937 new Getter_NodeReplacerTest_test_constructorDeclaration_2()); | 3928 new Getter_NodeReplacerTest_test_constructorDeclaration_2()); |
| 3938 _assertReplace( | 3929 _assertReplace( |
| 3939 node, | 3930 node, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3971 void test_continueStatement() { | 3962 void test_continueStatement() { |
| 3972 ContinueStatement node = AstFactory.continueStatement("l"); | 3963 ContinueStatement node = AstFactory.continueStatement("l"); |
| 3973 _assertReplace(node, new Getter_NodeReplacerTest_test_continueStatement()); | 3964 _assertReplace(node, new Getter_NodeReplacerTest_test_continueStatement()); |
| 3974 } | 3965 } |
| 3975 | 3966 |
| 3976 void test_declaredIdentifier() { | 3967 void test_declaredIdentifier() { |
| 3977 DeclaredIdentifier node = | 3968 DeclaredIdentifier node = |
| 3978 AstFactory.declaredIdentifier4(AstFactory.typeName4("C"), "i"); | 3969 AstFactory.declaredIdentifier4(AstFactory.typeName4("C"), "i"); |
| 3979 node.documentationComment = | 3970 node.documentationComment = |
| 3980 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3971 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| 3981 node.metadata = | 3972 node.metadata = [AstFactory.annotation(AstFactory.identifier3("a"))]; |
| 3982 [AstFactory.annotation(AstFactory.identifier3("a"))]; | |
| 3983 _assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier()); | 3973 _assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier()); |
| 3984 _assertReplace( | 3974 _assertReplace( |
| 3985 node, | 3975 node, |
| 3986 new Getter_NodeReplacerTest_test_declaredIdentifier_2()); | 3976 new Getter_NodeReplacerTest_test_declaredIdentifier_2()); |
| 3987 _testAnnotatedNode(node); | 3977 _testAnnotatedNode(node); |
| 3988 } | 3978 } |
| 3989 | 3979 |
| 3990 void test_defaultFormalParameter() { | 3980 void test_defaultFormalParameter() { |
| 3991 DefaultFormalParameter node = AstFactory.positionalFormalParameter( | 3981 DefaultFormalParameter node = AstFactory.positionalFormalParameter( |
| 3992 AstFactory.simpleFormalParameter3("p"), | 3982 AstFactory.simpleFormalParameter3("p"), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4012 [AstFactory.annotation(AstFactory.identifier3("a"))], | 4002 [AstFactory.annotation(AstFactory.identifier3("a"))], |
| 4013 AstFactory.identifier3("C")); | 4003 AstFactory.identifier3("C")); |
| 4014 _assertReplace( | 4004 _assertReplace( |
| 4015 node, | 4005 node, |
| 4016 new Getter_NodeReplacerTest_test_enumConstantDeclaration()); | 4006 new Getter_NodeReplacerTest_test_enumConstantDeclaration()); |
| 4017 _testAnnotatedNode(node); | 4007 _testAnnotatedNode(node); |
| 4018 } | 4008 } |
| 4019 | 4009 |
| 4020 void test_enumDeclaration() { | 4010 void test_enumDeclaration() { |
| 4021 EnumDeclaration node = AstFactory.enumDeclaration2("E", ["ONE", "TWO"]); | 4011 EnumDeclaration node = AstFactory.enumDeclaration2("E", ["ONE", "TWO"]); |
| 4022 node.documentationComment | 4012 node.documentationComment = |
| 4023 = Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 4013 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| 4024 node.metadata = [AstFactory.annotation(AstFactory.identifier3("a"))]; | 4014 node.metadata = [AstFactory.annotation(AstFactory.identifier3("a"))]; |
| 4025 _assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration()); | 4015 _assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration()); |
| 4026 _testAnnotatedNode(node); | 4016 _testAnnotatedNode(node); |
| 4027 } | 4017 } |
| 4028 | 4018 |
| 4029 void test_exportDirective() { | 4019 void test_exportDirective() { |
| 4030 ExportDirective node = | 4020 ExportDirective node = |
| 4031 AstFactory.exportDirective2("", [AstFactory.hideCombinator2(["C"])]); | 4021 AstFactory.exportDirective2("", [AstFactory.hideCombinator2(["C"])]); |
| 4032 node.documentationComment = | 4022 node.documentationComment = |
| 4033 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 4023 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4045 | 4035 |
| 4046 void test_expressionStatement() { | 4036 void test_expressionStatement() { |
| 4047 ExpressionStatement node = | 4037 ExpressionStatement node = |
| 4048 AstFactory.expressionStatement(AstFactory.integer(0)); | 4038 AstFactory.expressionStatement(AstFactory.integer(0)); |
| 4049 _assertReplace( | 4039 _assertReplace( |
| 4050 node, | 4040 node, |
| 4051 new Getter_NodeReplacerTest_test_expressionStatement()); | 4041 new Getter_NodeReplacerTest_test_expressionStatement()); |
| 4052 } | 4042 } |
| 4053 | 4043 |
| 4054 void test_extendsClause() { | 4044 void test_extendsClause() { |
| 4055 ExtendsClause node = | 4045 ExtendsClause node = AstFactory.extendsClause(AstFactory.typeName4("S")); |
| 4056 AstFactory.extendsClause(AstFactory.typeName4("S")); | |
| 4057 _assertReplace(node, new Getter_NodeReplacerTest_test_extendsClause()); | 4046 _assertReplace(node, new Getter_NodeReplacerTest_test_extendsClause()); |
| 4058 } | 4047 } |
| 4059 | 4048 |
| 4060 void test_fieldDeclaration() { | 4049 void test_fieldDeclaration() { |
| 4061 FieldDeclaration node = AstFactory.fieldDeclaration( | 4050 FieldDeclaration node = AstFactory.fieldDeclaration( |
| 4062 false, | 4051 false, |
| 4063 null, | 4052 null, |
| 4064 AstFactory.typeName4("C"), | 4053 AstFactory.typeName4("C"), |
| 4065 [AstFactory.variableDeclaration("c")]); | 4054 [AstFactory.variableDeclaration("c")]); |
| 4066 node.documentationComment = | 4055 node.documentationComment = |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4113 node, | 4102 node, |
| 4114 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_2()); | 4103 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_2()); |
| 4115 _assertReplace( | 4104 _assertReplace( |
| 4116 node, | 4105 node, |
| 4117 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable()); | 4106 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable()); |
| 4118 _assertReplace( | 4107 _assertReplace( |
| 4119 node, | 4108 node, |
| 4120 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_3()); | 4109 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_3()); |
| 4121 } | 4110 } |
| 4122 | 4111 |
| 4112 void test_formalParameterList() { |
| 4113 FormalParameterList node = |
| 4114 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("p")])
; |
| 4115 _assertReplace( |
| 4116 node, |
| 4117 new ListGetter_NodeReplacerTest_test_formalParameterList(0)); |
| 4118 } |
| 4119 |
| 4123 void test_forStatement_withInitialization() { | 4120 void test_forStatement_withInitialization() { |
| 4124 ForStatement node = AstFactory.forStatement( | 4121 ForStatement node = AstFactory.forStatement( |
| 4125 AstFactory.identifier3("a"), | 4122 AstFactory.identifier3("a"), |
| 4126 AstFactory.booleanLiteral(true), | 4123 AstFactory.booleanLiteral(true), |
| 4127 [AstFactory.integer(0)], | 4124 [AstFactory.integer(0)], |
| 4128 AstFactory.block()); | 4125 AstFactory.block()); |
| 4129 _assertReplace( | 4126 _assertReplace( |
| 4130 node, | 4127 node, |
| 4131 new Getter_NodeReplacerTest_test_forStatement_withInitialization_3()); | 4128 new Getter_NodeReplacerTest_test_forStatement_withInitialization_3()); |
| 4132 _assertReplace( | 4129 _assertReplace( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4155 node, | 4152 node, |
| 4156 new Getter_NodeReplacerTest_test_forStatement_withVariables_3()); | 4153 new Getter_NodeReplacerTest_test_forStatement_withVariables_3()); |
| 4157 _assertReplace( | 4154 _assertReplace( |
| 4158 node, | 4155 node, |
| 4159 new Getter_NodeReplacerTest_test_forStatement_withVariables()); | 4156 new Getter_NodeReplacerTest_test_forStatement_withVariables()); |
| 4160 _assertReplace( | 4157 _assertReplace( |
| 4161 node, | 4158 node, |
| 4162 new ListGetter_NodeReplacerTest_test_forStatement_withVariables(0)); | 4159 new ListGetter_NodeReplacerTest_test_forStatement_withVariables(0)); |
| 4163 } | 4160 } |
| 4164 | 4161 |
| 4165 void test_formalParameterList() { | |
| 4166 FormalParameterList node = | |
| 4167 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("p")])
; | |
| 4168 _assertReplace( | |
| 4169 node, | |
| 4170 new ListGetter_NodeReplacerTest_test_formalParameterList(0)); | |
| 4171 } | |
| 4172 | |
| 4173 void test_functionDeclaration() { | 4162 void test_functionDeclaration() { |
| 4174 FunctionDeclaration node = AstFactory.functionDeclaration( | 4163 FunctionDeclaration node = AstFactory.functionDeclaration( |
| 4175 AstFactory.typeName4("R"), | 4164 AstFactory.typeName4("R"), |
| 4176 null, | 4165 null, |
| 4177 "f", | 4166 "f", |
| 4178 AstFactory.functionExpression2( | 4167 AstFactory.functionExpression2( |
| 4179 AstFactory.formalParameterList(), | 4168 AstFactory.formalParameterList(), |
| 4180 AstFactory.blockFunctionBody(AstFactory.block()))); | 4169 AstFactory.blockFunctionBody(AstFactory.block()))); |
| 4181 node.documentationComment = | 4170 node.documentationComment = |
| 4182 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 4171 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4341 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression()); | 4330 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression()); |
| 4342 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression_2()); | 4331 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression_2()); |
| 4343 } | 4332 } |
| 4344 | 4333 |
| 4345 void test_label() { | 4334 void test_label() { |
| 4346 Label node = AstFactory.label2("l"); | 4335 Label node = AstFactory.label2("l"); |
| 4347 _assertReplace(node, new Getter_NodeReplacerTest_test_label()); | 4336 _assertReplace(node, new Getter_NodeReplacerTest_test_label()); |
| 4348 } | 4337 } |
| 4349 | 4338 |
| 4350 void test_labeledStatement() { | 4339 void test_labeledStatement() { |
| 4351 LabeledStatement node = AstFactory.labeledStatement( | 4340 LabeledStatement node = |
| 4352 [AstFactory.label2("l")], | 4341 AstFactory.labeledStatement([AstFactory.label2("l")], AstFactory.block()
); |
| 4353 AstFactory.block()); | |
| 4354 _assertReplace( | 4342 _assertReplace( |
| 4355 node, | 4343 node, |
| 4356 new ListGetter_NodeReplacerTest_test_labeledStatement(0)); | 4344 new ListGetter_NodeReplacerTest_test_labeledStatement(0)); |
| 4357 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement()); | 4345 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement()); |
| 4358 } | 4346 } |
| 4359 | 4347 |
| 4360 void test_libraryDirective() { | 4348 void test_libraryDirective() { |
| 4361 LibraryDirective node = AstFactory.libraryDirective2("lib"); | 4349 LibraryDirective node = AstFactory.libraryDirective2("lib"); |
| 4362 node.documentationComment = | 4350 node.documentationComment = |
| 4363 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 4351 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4476 _testAnnotatedNode(node); | 4464 _testAnnotatedNode(node); |
| 4477 } | 4465 } |
| 4478 | 4466 |
| 4479 void test_postfixExpression() { | 4467 void test_postfixExpression() { |
| 4480 PostfixExpression node = AstFactory.postfixExpression( | 4468 PostfixExpression node = AstFactory.postfixExpression( |
| 4481 AstFactory.identifier3("x"), | 4469 AstFactory.identifier3("x"), |
| 4482 TokenType.MINUS_MINUS); | 4470 TokenType.MINUS_MINUS); |
| 4483 _assertReplace(node, new Getter_NodeReplacerTest_test_postfixExpression()); | 4471 _assertReplace(node, new Getter_NodeReplacerTest_test_postfixExpression()); |
| 4484 } | 4472 } |
| 4485 | 4473 |
| 4486 void test_prefixExpression() { | |
| 4487 PrefixExpression node = | |
| 4488 AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3(
"y")); | |
| 4489 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixExpression()); | |
| 4490 } | |
| 4491 | |
| 4492 void test_prefixedIdentifier() { | 4474 void test_prefixedIdentifier() { |
| 4493 PrefixedIdentifier node = AstFactory.identifier5("a", "b"); | 4475 PrefixedIdentifier node = AstFactory.identifier5("a", "b"); |
| 4494 _assertReplace( | 4476 _assertReplace( |
| 4495 node, | 4477 node, |
| 4496 new Getter_NodeReplacerTest_test_prefixedIdentifier_2()); | 4478 new Getter_NodeReplacerTest_test_prefixedIdentifier_2()); |
| 4497 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixedIdentifier()); | 4479 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixedIdentifier()); |
| 4498 } | 4480 } |
| 4499 | 4481 |
| 4482 void test_prefixExpression() { |
| 4483 PrefixExpression node = |
| 4484 AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3(
"y")); |
| 4485 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixExpression()); |
| 4486 } |
| 4487 |
| 4500 void test_propertyAccess() { | 4488 void test_propertyAccess() { |
| 4501 PropertyAccess node = | 4489 PropertyAccess node = |
| 4502 AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y"); | 4490 AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y"); |
| 4503 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess()); | 4491 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess()); |
| 4504 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess_2()); | 4492 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess_2()); |
| 4505 } | 4493 } |
| 4506 | 4494 |
| 4507 void test_redirectingConstructorInvocation() { | 4495 void test_redirectingConstructorInvocation() { |
| 4508 RedirectingConstructorInvocation node = | 4496 RedirectingConstructorInvocation node = |
| 4509 AstFactory.redirectingConstructorInvocation2("c", [AstFactory.integer(0)
]); | 4497 AstFactory.redirectingConstructorInvocation2("c", [AstFactory.integer(0)
]); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4561 void test_switchCase() { | 4549 void test_switchCase() { |
| 4562 SwitchCase node = AstFactory.switchCase2( | 4550 SwitchCase node = AstFactory.switchCase2( |
| 4563 [AstFactory.label2("l")], | 4551 [AstFactory.label2("l")], |
| 4564 AstFactory.integer(0), | 4552 AstFactory.integer(0), |
| 4565 [AstFactory.block()]); | 4553 [AstFactory.block()]); |
| 4566 _assertReplace(node, new Getter_NodeReplacerTest_test_switchCase()); | 4554 _assertReplace(node, new Getter_NodeReplacerTest_test_switchCase()); |
| 4567 _testSwitchMember(node); | 4555 _testSwitchMember(node); |
| 4568 } | 4556 } |
| 4569 | 4557 |
| 4570 void test_switchDefault() { | 4558 void test_switchDefault() { |
| 4571 SwitchDefault node = AstFactory.switchDefault( | 4559 SwitchDefault node = |
| 4572 [AstFactory.label2("l")], | 4560 AstFactory.switchDefault([AstFactory.label2("l")], [AstFactory.block()])
; |
| 4573 [AstFactory.block()]); | |
| 4574 _testSwitchMember(node); | 4561 _testSwitchMember(node); |
| 4575 } | 4562 } |
| 4576 | 4563 |
| 4577 void test_switchStatement() { | 4564 void test_switchStatement() { |
| 4578 SwitchStatement node = AstFactory.switchStatement( | 4565 SwitchStatement node = AstFactory.switchStatement( |
| 4579 AstFactory.identifier3("x"), | 4566 AstFactory.identifier3("x"), |
| 4580 [ | 4567 [ |
| 4581 AstFactory.switchCase2( | 4568 AstFactory.switchCase2( |
| 4582 [AstFactory.label2("l")], | 4569 [AstFactory.label2("l")], |
| 4583 AstFactory.integer(0), | 4570 AstFactory.integer(0), |
| 4584 [AstFactory.block()]), | 4571 [AstFactory.block()]), |
| 4585 AstFactory.switchDefault( | 4572 AstFactory.switchDefault([AstFactory.label2("l")], [AstFactory.block
()])]); |
| 4586 [AstFactory.label2("l")], | |
| 4587 [AstFactory.block()])]); | |
| 4588 _assertReplace(node, new Getter_NodeReplacerTest_test_switchStatement()); | 4573 _assertReplace(node, new Getter_NodeReplacerTest_test_switchStatement()); |
| 4589 _assertReplace( | 4574 _assertReplace( |
| 4590 node, | 4575 node, |
| 4591 new ListGetter_NodeReplacerTest_test_switchStatement(0)); | 4576 new ListGetter_NodeReplacerTest_test_switchStatement(0)); |
| 4592 } | 4577 } |
| 4593 | 4578 |
| 4594 void test_throwExpression() { | 4579 void test_throwExpression() { |
| 4595 ThrowExpression node = | 4580 ThrowExpression node = |
| 4596 AstFactory.throwExpression2(AstFactory.identifier3("e")); | 4581 AstFactory.throwExpression2(AstFactory.identifier3("e")); |
| 4597 _assertReplace(node, new Getter_NodeReplacerTest_test_throwExpression()); | 4582 _assertReplace(node, new Getter_NodeReplacerTest_test_throwExpression()); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4683 VariableDeclarationStatement node = AstFactory.variableDeclarationStatement( | 4668 VariableDeclarationStatement node = AstFactory.variableDeclarationStatement( |
| 4684 null, | 4669 null, |
| 4685 AstFactory.typeName4("T"), | 4670 AstFactory.typeName4("T"), |
| 4686 [AstFactory.variableDeclaration("a")]); | 4671 [AstFactory.variableDeclaration("a")]); |
| 4687 _assertReplace( | 4672 _assertReplace( |
| 4688 node, | 4673 node, |
| 4689 new Getter_NodeReplacerTest_test_variableDeclarationStatement()); | 4674 new Getter_NodeReplacerTest_test_variableDeclarationStatement()); |
| 4690 } | 4675 } |
| 4691 | 4676 |
| 4692 void test_whileStatement() { | 4677 void test_whileStatement() { |
| 4693 WhileStatement node = AstFactory.whileStatement( | 4678 WhileStatement node = |
| 4694 AstFactory.booleanLiteral(true), | 4679 AstFactory.whileStatement(AstFactory.booleanLiteral(true), AstFactory.bl
ock()); |
| 4695 AstFactory.block()); | |
| 4696 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement()); | 4680 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement()); |
| 4697 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement_2()); | 4681 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement_2()); |
| 4698 } | 4682 } |
| 4699 | 4683 |
| 4700 void test_withClause() { | 4684 void test_withClause() { |
| 4701 WithClause node = AstFactory.withClause([AstFactory.typeName4("M")]); | 4685 WithClause node = AstFactory.withClause([AstFactory.typeName4("M")]); |
| 4702 _assertReplace(node, new ListGetter_NodeReplacerTest_test_withClause(0)); | 4686 _assertReplace(node, new ListGetter_NodeReplacerTest_test_withClause(0)); |
| 4703 } | 4687 } |
| 4704 | 4688 |
| 4705 void _assertReplace(AstNode parent, NodeReplacerTest_Getter getter) { | 4689 void _assertReplace(AstNode parent, NodeReplacerTest_Getter getter) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4922 } | 4906 } |
| 4923 | 4907 |
| 4924 void test_getTranslated() { | 4908 void test_getTranslated() { |
| 4925 SourceRange r = new SourceRange(5, 3); | 4909 SourceRange r = new SourceRange(5, 3); |
| 4926 expect(r.getTranslated(0), r); | 4910 expect(r.getTranslated(0), r); |
| 4927 expect(r.getTranslated(2), new SourceRange(7, 3)); | 4911 expect(r.getTranslated(2), new SourceRange(7, 3)); |
| 4928 expect(r.getTranslated(-1), new SourceRange(4, 3)); | 4912 expect(r.getTranslated(-1), new SourceRange(4, 3)); |
| 4929 } | 4913 } |
| 4930 | 4914 |
| 4931 void test_getUnion() { | 4915 void test_getUnion() { |
| 4932 expect(new SourceRange(10, 10).getUnion(new SourceRange(15, 10)), new Source
Range(10, 15)); | 4916 expect( |
| 4933 expect(new SourceRange(15, 10).getUnion(new SourceRange(10, 10)), new Source
Range(10, 15)); | 4917 new SourceRange(10, 10).getUnion(new SourceRange(15, 10)), |
| 4918 new SourceRange(10, 15)); |
| 4919 expect( |
| 4920 new SourceRange(15, 10).getUnion(new SourceRange(10, 10)), |
| 4921 new SourceRange(10, 15)); |
| 4934 // "other" is covered/covers | 4922 // "other" is covered/covers |
| 4935 expect(new SourceRange(10, 10).getUnion(new SourceRange(15, 2)), new SourceR
ange(10, 10)); | 4923 expect( |
| 4936 expect(new SourceRange(15, 2).getUnion(new SourceRange(10, 10)), new SourceR
ange(10, 10)); | 4924 new SourceRange(10, 10).getUnion(new SourceRange(15, 2)), |
| 4925 new SourceRange(10, 10)); |
| 4926 expect( |
| 4927 new SourceRange(15, 2).getUnion(new SourceRange(10, 10)), |
| 4928 new SourceRange(10, 10)); |
| 4937 } | 4929 } |
| 4938 | 4930 |
| 4939 void test_intersects() { | 4931 void test_intersects() { |
| 4940 SourceRange r = new SourceRange(5, 3); | 4932 SourceRange r = new SourceRange(5, 3); |
| 4941 // null | 4933 // null |
| 4942 expect(r.intersects(null), isFalse); | 4934 expect(r.intersects(null), isFalse); |
| 4943 // ends before | 4935 // ends before |
| 4944 expect(r.intersects(new SourceRange(0, 5)), isFalse); | 4936 expect(r.intersects(new SourceRange(0, 5)), isFalse); |
| 4945 // begins after | 4937 // begins after |
| 4946 expect(r.intersects(new SourceRange(8, 5)), isFalse); | 4938 expect(r.intersects(new SourceRange(8, 5)), isFalse); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5012 expect(StringUtilities.indexOf2("abcdef", 0, 0x64, 0x61), -1); | 5004 expect(StringUtilities.indexOf2("abcdef", 0, 0x64, 0x61), -1); |
| 5013 expect(StringUtilities.indexOf2("abcdef", 1, 0x61, 0x62), -1); | 5005 expect(StringUtilities.indexOf2("abcdef", 1, 0x61, 0x62), -1); |
| 5014 // before start | 5006 // before start |
| 5015 } | 5007 } |
| 5016 | 5008 |
| 5017 void test_indexOf4() { | 5009 void test_indexOf4() { |
| 5018 expect(StringUtilities.indexOf4("abcd", 0, 0x61, 0x62, 0x63, 0x64), 0); | 5010 expect(StringUtilities.indexOf4("abcd", 0, 0x61, 0x62, 0x63, 0x64), 0); |
| 5019 expect(StringUtilities.indexOf4("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64), 0); | 5011 expect(StringUtilities.indexOf4("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64), 0); |
| 5020 expect(StringUtilities.indexOf4("abcdefghi", 0, 0x63, 0x64, 0x65, 0x66), 2); | 5012 expect(StringUtilities.indexOf4("abcdefghi", 0, 0x63, 0x64, 0x65, 0x66), 2); |
| 5021 expect(StringUtilities.indexOf4("abcdefghi", 0, 0x66, 0x67, 0x68, 0x69), 5); | 5013 expect(StringUtilities.indexOf4("abcdefghi", 0, 0x66, 0x67, 0x68, 0x69), 5); |
| 5022 expect(StringUtilities.indexOf4("abcdefghi", 0, 0x64, 0x65, 0x61, 0x64), -1)
; | 5014 expect( |
| 5023 expect(StringUtilities.indexOf4("abcdefghi", 1, 0x61, 0x62, 0x63, 0x64), -1)
; | 5015 StringUtilities.indexOf4("abcdefghi", 0, 0x64, 0x65, 0x61, 0x64), |
| 5016 -1); |
| 5017 expect( |
| 5018 StringUtilities.indexOf4("abcdefghi", 1, 0x61, 0x62, 0x63, 0x64), |
| 5019 -1); |
| 5024 // before start | 5020 // before start |
| 5025 } | 5021 } |
| 5026 | 5022 |
| 5027 void test_indexOf5() { | 5023 void test_indexOf5() { |
| 5028 expect(StringUtilities.indexOf5("abcde", 0, 0x61, 0x62, 0x63, 0x64, 0x65), 0
); | 5024 expect( |
| 5029 expect(StringUtilities.indexOf5("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64, 0x65
), 0); | 5025 StringUtilities.indexOf5("abcde", 0, 0x61, 0x62, 0x63, 0x64, 0x65), |
| 5030 expect(StringUtilities.indexOf5("abcdefghi", 0, 0x63, 0x64, 0x65, 0x66, 0x67
), 2); | 5026 0); |
| 5031 expect(StringUtilities.indexOf5("abcdefghi", 0, 0x65, 0x66, 0x67, 0x68, 0x69
), 4); | 5027 expect( |
| 5032 expect(StringUtilities.indexOf5("abcdefghi", 0, 0x64, 0x65, 0x66, 0x69, 0x6E
), -1); | 5028 StringUtilities.indexOf5("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64, 0x65), |
| 5033 expect(StringUtilities.indexOf5("abcdefghi", 1, 0x61, 0x62, 0x63, 0x64, 0x65
), -1); | 5029 0); |
| 5030 expect( |
| 5031 StringUtilities.indexOf5("abcdefghi", 0, 0x63, 0x64, 0x65, 0x66, 0x67), |
| 5032 2); |
| 5033 expect( |
| 5034 StringUtilities.indexOf5("abcdefghi", 0, 0x65, 0x66, 0x67, 0x68, 0x69), |
| 5035 4); |
| 5036 expect( |
| 5037 StringUtilities.indexOf5("abcdefghi", 0, 0x64, 0x65, 0x66, 0x69, 0x6E), |
| 5038 -1); |
| 5039 expect( |
| 5040 StringUtilities.indexOf5("abcdefghi", 1, 0x61, 0x62, 0x63, 0x64, 0x65), |
| 5041 -1); |
| 5034 // before start | 5042 // before start |
| 5035 } | 5043 } |
| 5036 | 5044 |
| 5037 void test_isEmpty() { | 5045 void test_isEmpty() { |
| 5038 expect(StringUtilities.isEmpty(""), isTrue); | 5046 expect(StringUtilities.isEmpty(""), isTrue); |
| 5039 expect(StringUtilities.isEmpty(" "), isFalse); | 5047 expect(StringUtilities.isEmpty(" "), isFalse); |
| 5040 expect(StringUtilities.isEmpty("a"), isFalse); | 5048 expect(StringUtilities.isEmpty("a"), isFalse); |
| 5041 expect(StringUtilities.isEmpty(StringUtilities.EMPTY), isTrue); | 5049 expect(StringUtilities.isEmpty(StringUtilities.EMPTY), isTrue); |
| 5042 } | 5050 } |
| 5043 | 5051 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5057 void test_printListOfQuotedNames_empty() { | 5065 void test_printListOfQuotedNames_empty() { |
| 5058 try { | 5066 try { |
| 5059 StringUtilities.printListOfQuotedNames(new List<String>(0)); | 5067 StringUtilities.printListOfQuotedNames(new List<String>(0)); |
| 5060 fail("Expected IllegalArgumentException"); | 5068 fail("Expected IllegalArgumentException"); |
| 5061 } on IllegalArgumentException catch (exception) { | 5069 } on IllegalArgumentException catch (exception) { |
| 5062 // Expected | 5070 // Expected |
| 5063 } | 5071 } |
| 5064 } | 5072 } |
| 5065 | 5073 |
| 5066 void test_printListOfQuotedNames_five() { | 5074 void test_printListOfQuotedNames_five() { |
| 5067 expect(StringUtilities.printListOfQuotedNames(<String>["a", "b", "c", "d", "
e"]), "'a', 'b', 'c', 'd' and 'e'"); | 5075 expect( |
| 5076 StringUtilities.printListOfQuotedNames(<String>["a", "b", "c", "d", "e"]
), |
| 5077 "'a', 'b', 'c', 'd' and 'e'"); |
| 5068 } | 5078 } |
| 5069 | 5079 |
| 5070 void test_printListOfQuotedNames_null() { | 5080 void test_printListOfQuotedNames_null() { |
| 5071 try { | 5081 try { |
| 5072 StringUtilities.printListOfQuotedNames(null); | 5082 StringUtilities.printListOfQuotedNames(null); |
| 5073 fail("Expected IllegalArgumentException"); | 5083 fail("Expected IllegalArgumentException"); |
| 5074 } on IllegalArgumentException catch (exception) { | 5084 } on IllegalArgumentException catch (exception) { |
| 5075 // Expected | 5085 // Expected |
| 5076 } | 5086 } |
| 5077 } | 5087 } |
| 5078 | 5088 |
| 5079 void test_printListOfQuotedNames_one() { | 5089 void test_printListOfQuotedNames_one() { |
| 5080 try { | 5090 try { |
| 5081 StringUtilities.printListOfQuotedNames(<String>["a"]); | 5091 StringUtilities.printListOfQuotedNames(<String>["a"]); |
| 5082 fail("Expected IllegalArgumentException"); | 5092 fail("Expected IllegalArgumentException"); |
| 5083 } on IllegalArgumentException catch (exception) { | 5093 } on IllegalArgumentException catch (exception) { |
| 5084 // Expected | 5094 // Expected |
| 5085 } | 5095 } |
| 5086 } | 5096 } |
| 5087 | 5097 |
| 5088 void test_printListOfQuotedNames_three() { | 5098 void test_printListOfQuotedNames_three() { |
| 5089 expect(StringUtilities.printListOfQuotedNames(<String>["a", "b", "c"]), "'a'
, 'b' and 'c'"); | 5099 expect( |
| 5100 StringUtilities.printListOfQuotedNames(<String>["a", "b", "c"]), |
| 5101 "'a', 'b' and 'c'"); |
| 5090 } | 5102 } |
| 5091 | 5103 |
| 5092 void test_printListOfQuotedNames_two() { | 5104 void test_printListOfQuotedNames_two() { |
| 5093 expect(StringUtilities.printListOfQuotedNames(<String>["a", "b"]), "'a' and
'b'"); | 5105 expect( |
| 5106 StringUtilities.printListOfQuotedNames(<String>["a", "b"]), |
| 5107 "'a' and 'b'"); |
| 5094 } | 5108 } |
| 5095 | 5109 |
| 5096 void test_startsWith2() { | 5110 void test_startsWith2() { |
| 5097 expect(StringUtilities.startsWith2("ab", 0, 0x61, 0x62), isTrue); | 5111 expect(StringUtilities.startsWith2("ab", 0, 0x61, 0x62), isTrue); |
| 5098 expect(StringUtilities.startsWith2("abcdefghi", 0, 0x61, 0x62), isTrue); | 5112 expect(StringUtilities.startsWith2("abcdefghi", 0, 0x61, 0x62), isTrue); |
| 5099 expect(StringUtilities.startsWith2("abcdefghi", 2, 0x63, 0x64), isTrue); | 5113 expect(StringUtilities.startsWith2("abcdefghi", 2, 0x63, 0x64), isTrue); |
| 5100 expect(StringUtilities.startsWith2("abcdefghi", 5, 0x66, 0x67), isTrue); | 5114 expect(StringUtilities.startsWith2("abcdefghi", 5, 0x66, 0x67), isTrue); |
| 5101 expect(StringUtilities.startsWith2("abcdefghi", 0, 0x64, 0x64), isFalse); | 5115 expect(StringUtilities.startsWith2("abcdefghi", 0, 0x64, 0x64), isFalse); |
| 5102 // missing | 5116 // missing |
| 5103 } | 5117 } |
| 5104 | 5118 |
| 5105 void test_startsWith3() { | 5119 void test_startsWith3() { |
| 5106 expect(StringUtilities.startsWith3("abc", 0, 0x61, 0x62, 0x63), isTrue); | 5120 expect(StringUtilities.startsWith3("abc", 0, 0x61, 0x62, 0x63), isTrue); |
| 5107 expect(StringUtilities.startsWith3("abcdefghi", 0, 0x61, 0x62, 0x63), isTrue
); | 5121 expect( |
| 5108 expect(StringUtilities.startsWith3("abcdefghi", 2, 0x63, 0x64, 0x65), isTrue
); | 5122 StringUtilities.startsWith3("abcdefghi", 0, 0x61, 0x62, 0x63), |
| 5109 expect(StringUtilities.startsWith3("abcdefghi", 6, 0x67, 0x68, 0x69), isTrue
); | 5123 isTrue); |
| 5110 expect(StringUtilities.startsWith3("abcdefghi", 0, 0x64, 0x65, 0x61), isFals
e); | 5124 expect( |
| 5125 StringUtilities.startsWith3("abcdefghi", 2, 0x63, 0x64, 0x65), |
| 5126 isTrue); |
| 5127 expect( |
| 5128 StringUtilities.startsWith3("abcdefghi", 6, 0x67, 0x68, 0x69), |
| 5129 isTrue); |
| 5130 expect( |
| 5131 StringUtilities.startsWith3("abcdefghi", 0, 0x64, 0x65, 0x61), |
| 5132 isFalse); |
| 5111 // missing | 5133 // missing |
| 5112 } | 5134 } |
| 5113 | 5135 |
| 5114 void test_startsWith4() { | 5136 void test_startsWith4() { |
| 5115 expect(StringUtilities.startsWith4("abcd", 0, 0x61, 0x62, 0x63, 0x64), isTru
e); | 5137 expect( |
| 5116 expect(StringUtilities.startsWith4("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64),
isTrue); | 5138 StringUtilities.startsWith4("abcd", 0, 0x61, 0x62, 0x63, 0x64), |
| 5117 expect(StringUtilities.startsWith4("abcdefghi", 2, 0x63, 0x64, 0x65, 0x66),
isTrue); | 5139 isTrue); |
| 5118 expect(StringUtilities.startsWith4("abcdefghi", 5, 0x66, 0x67, 0x68, 0x69),
isTrue); | 5140 expect( |
| 5119 expect(StringUtilities.startsWith4("abcdefghi", 0, 0x64, 0x65, 0x61, 0x64),
isFalse); | 5141 StringUtilities.startsWith4("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64), |
| 5142 isTrue); |
| 5143 expect( |
| 5144 StringUtilities.startsWith4("abcdefghi", 2, 0x63, 0x64, 0x65, 0x66), |
| 5145 isTrue); |
| 5146 expect( |
| 5147 StringUtilities.startsWith4("abcdefghi", 5, 0x66, 0x67, 0x68, 0x69), |
| 5148 isTrue); |
| 5149 expect( |
| 5150 StringUtilities.startsWith4("abcdefghi", 0, 0x64, 0x65, 0x61, 0x64), |
| 5151 isFalse); |
| 5120 // missing | 5152 // missing |
| 5121 } | 5153 } |
| 5122 | 5154 |
| 5123 void test_startsWith5() { | 5155 void test_startsWith5() { |
| 5124 expect(StringUtilities.startsWith5("abcde", 0, 0x61, 0x62, 0x63, 0x64, 0x65)
, isTrue); | 5156 expect( |
| 5125 expect(StringUtilities.startsWith5("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64, 0
x65), isTrue); | 5157 StringUtilities.startsWith5("abcde", 0, 0x61, 0x62, 0x63, 0x64, 0x65), |
| 5126 expect(StringUtilities.startsWith5("abcdefghi", 2, 0x63, 0x64, 0x65, 0x66, 0
x67), isTrue); | 5158 isTrue); |
| 5127 expect(StringUtilities.startsWith5("abcdefghi", 4, 0x65, 0x66, 0x67, 0x68, 0
x69), isTrue); | 5159 expect( |
| 5128 expect(StringUtilities.startsWith5("abcdefghi", 0, 0x61, 0x62, 0x63, 0x62, 0
x61), isFalse); | 5160 StringUtilities.startsWith5("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64, 0x65
), |
| 5161 isTrue); |
| 5162 expect( |
| 5163 StringUtilities.startsWith5("abcdefghi", 2, 0x63, 0x64, 0x65, 0x66, 0x67
), |
| 5164 isTrue); |
| 5165 expect( |
| 5166 StringUtilities.startsWith5("abcdefghi", 4, 0x65, 0x66, 0x67, 0x68, 0x69
), |
| 5167 isTrue); |
| 5168 expect( |
| 5169 StringUtilities.startsWith5("abcdefghi", 0, 0x61, 0x62, 0x63, 0x62, 0x61
), |
| 5170 isFalse); |
| 5129 // missing | 5171 // missing |
| 5130 } | 5172 } |
| 5131 | 5173 |
| 5132 void test_startsWith6() { | 5174 void test_startsWith6() { |
| 5133 expect(StringUtilities.startsWith6("abcdef", 0, 0x61, 0x62, 0x63, 0x64, 0x65
, 0x66), isTrue); | 5175 expect( |
| 5134 expect(StringUtilities.startsWith6( | 5176 StringUtilities.startsWith6("abcdef", 0, 0x61, 0x62, 0x63, 0x64, 0x65, 0
x66), |
| 5135 "abcdefghi", | 5177 isTrue); |
| 5136 0, | 5178 expect( |
| 5137 0x61, | 5179 StringUtilities.startsWith6("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64, 0x65
, 0x66), |
| 5138 0x62, | 5180 isTrue); |
| 5139 0x63, | 5181 expect( |
| 5140 0x64, | 5182 StringUtilities.startsWith6("abcdefghi", 2, 0x63, 0x64, 0x65, 0x66, 0x67
, 0x68), |
| 5141 0x65, | 5183 isTrue); |
| 5142 0x66), isTrue); | 5184 expect( |
| 5143 expect(StringUtilities.startsWith6( | 5185 StringUtilities.startsWith6("abcdefghi", 3, 0x64, 0x65, 0x66, 0x67, 0x68
, 0x69), |
| 5144 "abcdefghi", | 5186 isTrue); |
| 5145 2, | 5187 expect( |
| 5146 0x63, | 5188 StringUtilities.startsWith6("abcdefghi", 0, 0x61, 0x62, 0x63, 0x64, 0x65
, 0x67), |
| 5147 0x64, | 5189 isFalse); |
| 5148 0x65, | |
| 5149 0x66, | |
| 5150 0x67, | |
| 5151 0x68), isTrue); | |
| 5152 expect(StringUtilities.startsWith6( | |
| 5153 "abcdefghi", | |
| 5154 3, | |
| 5155 0x64, | |
| 5156 0x65, | |
| 5157 0x66, | |
| 5158 0x67, | |
| 5159 0x68, | |
| 5160 0x69), isTrue); | |
| 5161 expect(StringUtilities.startsWith6( | |
| 5162 "abcdefghi", | |
| 5163 0, | |
| 5164 0x61, | |
| 5165 0x62, | |
| 5166 0x63, | |
| 5167 0x64, | |
| 5168 0x65, | |
| 5169 0x67), isFalse); | |
| 5170 // missing | 5190 // missing |
| 5171 } | 5191 } |
| 5172 | 5192 |
| 5173 void test_startsWithChar() { | 5193 void test_startsWithChar() { |
| 5174 expect(StringUtilities.startsWithChar("a", 0x61), isTrue); | 5194 expect(StringUtilities.startsWithChar("a", 0x61), isTrue); |
| 5175 expect(StringUtilities.startsWithChar("b", 0x61), isFalse); | 5195 expect(StringUtilities.startsWithChar("b", 0x61), isFalse); |
| 5176 expect(StringUtilities.startsWithChar("", 0x61), isFalse); | 5196 expect(StringUtilities.startsWithChar("", 0x61), isFalse); |
| 5177 } | 5197 } |
| 5178 | 5198 |
| 5179 void test_substringBefore() { | 5199 void test_substringBefore() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 5210 } | 5230 } |
| 5211 | 5231 |
| 5212 void test_get_added() { | 5232 void test_get_added() { |
| 5213 TokenMap tokenMap = new TokenMap(); | 5233 TokenMap tokenMap = new TokenMap(); |
| 5214 Token key = TokenFactory.tokenFromType(TokenType.AT); | 5234 Token key = TokenFactory.tokenFromType(TokenType.AT); |
| 5215 Token value = TokenFactory.tokenFromType(TokenType.AT); | 5235 Token value = TokenFactory.tokenFromType(TokenType.AT); |
| 5216 tokenMap.put(key, value); | 5236 tokenMap.put(key, value); |
| 5217 expect(tokenMap.get(key), same(value)); | 5237 expect(tokenMap.get(key), same(value)); |
| 5218 } | 5238 } |
| 5219 } | 5239 } |
| OLD | NEW |