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.element_test; | 8 library engine.element_test; |
9 | 9 |
10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 LibraryElementImpl library = ElementFactory.library(context, "app"); | 345 LibraryElementImpl library = ElementFactory.library(context, "app"); |
346 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], library.v
isibleLibraries); | 346 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], library.v
isibleLibraries); |
347 } | 347 } |
348 | 348 |
349 void test_isUpToDate() { | 349 void test_isUpToDate() { |
350 AnalysisContext context = createAnalysisContext(); | 350 AnalysisContext context = createAnalysisContext(); |
351 context.sourceFactory = new SourceFactory([]); | 351 context.sourceFactory = new SourceFactory([]); |
352 LibraryElement library = ElementFactory.library(context, "foo"); | 352 LibraryElement library = ElementFactory.library(context, "foo"); |
353 context.setContents(library.definingCompilationUnit.source, "sdfsdff"); | 353 context.setContents(library.definingCompilationUnit.source, "sdfsdff"); |
354 // Assert that we are not up to date if the target has an old time stamp. | 354 // Assert that we are not up to date if the target has an old time stamp. |
355 JUnitTestCase.assertFalse(library.isUpToDate2(0)); | 355 JUnitTestCase.assertFalse(library.isUpToDate(0)); |
356 // Assert that we are up to date with a target modification time in the futu
re. | 356 // Assert that we are up to date with a target modification time in the futu
re. |
357 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); | 357 JUnitTestCase.assertTrue(library.isUpToDate(JavaSystem.currentTimeMillis() +
1000)); |
358 } | 358 } |
359 | 359 |
360 void test_setImports() { | 360 void test_setImports() { |
361 AnalysisContext context = createAnalysisContext(); | 361 AnalysisContext context = createAnalysisContext(); |
362 LibraryElementImpl library = new LibraryElementImpl(context, AstFactory.libr
aryIdentifier2(["l1"])); | 362 LibraryElementImpl library = new LibraryElementImpl(context, AstFactory.libr
aryIdentifier2(["l1"])); |
363 List<ImportElementImpl> expectedImports = [ | 363 List<ImportElementImpl> expectedImports = [ |
364 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), | 364 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
365 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; | 365 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; |
366 library.imports = expectedImports; | 366 library.imports = expectedImports; |
367 List<ImportElement> actualImports = library.imports; | 367 List<ImportElement> actualImports = library.imports; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 707 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
708 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 708 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
709 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 709 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
710 ClassElementImpl classE = ElementFactory.classElement2("E", []); | 710 ClassElementImpl classE = ElementFactory.classElement2("E", []); |
711 classB.interfaces = <InterfaceType> [classA.type]; | 711 classB.interfaces = <InterfaceType> [classA.type]; |
712 classC.interfaces = <InterfaceType> [classA.type]; | 712 classC.interfaces = <InterfaceType> [classA.type]; |
713 classD.interfaces = <InterfaceType> [classC.type]; | 713 classD.interfaces = <InterfaceType> [classC.type]; |
714 classE.interfaces = <InterfaceType> [classB.type, classD.type]; | 714 classE.interfaces = <InterfaceType> [classB.type, classD.type]; |
715 // D | 715 // D |
716 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 716 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
717 EngineTestCase.assertSize3(3, superinterfacesOfD); | 717 EngineTestCase.assertSizeOfSet(3, superinterfacesOfD); |
718 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 718 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
719 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 719 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
720 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 720 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
721 // E | 721 // E |
722 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 722 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
723 EngineTestCase.assertSize3(5, superinterfacesOfE); | 723 EngineTestCase.assertSizeOfSet(5, superinterfacesOfE); |
724 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 724 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
725 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 725 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
726 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 726 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
727 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 727 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
728 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 728 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
729 } | 729 } |
730 | 730 |
731 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { | 731 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { |
732 ClassElement classA = ElementFactory.classElement2("A", []); | 732 ClassElement classA = ElementFactory.classElement2("A", []); |
733 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 733 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
734 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 734 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
735 ClassElement classD = ElementFactory.classElement("D", classC.type, []); | 735 ClassElement classD = ElementFactory.classElement("D", classC.type, []); |
736 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 736 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
737 classE.interfaces = <InterfaceType> [classD.type]; | 737 classE.interfaces = <InterfaceType> [classD.type]; |
738 // D | 738 // D |
739 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 739 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
740 EngineTestCase.assertSize3(3, superinterfacesOfD); | 740 EngineTestCase.assertSizeOfSet(3, superinterfacesOfD); |
741 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 741 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
742 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 742 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
743 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 743 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
744 // E | 744 // E |
745 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 745 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
746 EngineTestCase.assertSize3(5, superinterfacesOfE); | 746 EngineTestCase.assertSizeOfSet(5, superinterfacesOfE); |
747 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 747 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
748 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 748 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
749 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 749 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
750 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 750 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
751 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 751 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
752 } | 752 } |
753 | 753 |
754 void test_computeSuperinterfaceSet_recursion() { | 754 void test_computeSuperinterfaceSet_recursion() { |
755 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 755 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
756 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 756 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
757 classA.supertype = classB.type; | 757 classA.supertype = classB.type; |
758 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 758 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
759 EngineTestCase.assertSize3(2, superinterfacesOfB); | 759 EngineTestCase.assertSizeOfSet(2, superinterfacesOfB); |
760 } | 760 } |
761 | 761 |
762 void test_computeSuperinterfaceSet_singleInterfacePath() { | 762 void test_computeSuperinterfaceSet_singleInterfacePath() { |
763 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 763 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
764 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 764 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
765 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 765 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
766 classB.interfaces = <InterfaceType> [classA.type]; | 766 classB.interfaces = <InterfaceType> [classA.type]; |
767 classC.interfaces = <InterfaceType> [classB.type]; | 767 classC.interfaces = <InterfaceType> [classB.type]; |
768 // A | 768 // A |
769 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 769 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
770 EngineTestCase.assertSize3(1, superinterfacesOfA); | 770 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA); |
771 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 771 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
772 // B | 772 // B |
773 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 773 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
774 EngineTestCase.assertSize3(2, superinterfacesOfB); | 774 EngineTestCase.assertSizeOfSet(2, superinterfacesOfB); |
775 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 775 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
776 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 776 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
777 // C | 777 // C |
778 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 778 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
779 EngineTestCase.assertSize3(3, superinterfacesOfC); | 779 EngineTestCase.assertSizeOfSet(3, superinterfacesOfC); |
780 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 780 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
781 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 781 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
782 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 782 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
783 } | 783 } |
784 | 784 |
785 void test_computeSuperinterfaceSet_singleSuperclassPath() { | 785 void test_computeSuperinterfaceSet_singleSuperclassPath() { |
786 // | 786 // |
787 // A | 787 // A |
788 // | | 788 // | |
789 // B | 789 // B |
790 // | | 790 // | |
791 // C | 791 // C |
792 // | 792 // |
793 ClassElement classA = ElementFactory.classElement2("A", []); | 793 ClassElement classA = ElementFactory.classElement2("A", []); |
794 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 794 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
795 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 795 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
796 // A | 796 // A |
797 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 797 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
798 EngineTestCase.assertSize3(1, superinterfacesOfA); | 798 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA); |
799 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 799 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
800 // B | 800 // B |
801 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 801 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
802 EngineTestCase.assertSize3(2, superinterfacesOfB); | 802 EngineTestCase.assertSizeOfSet(2, superinterfacesOfB); |
803 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 803 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
804 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 804 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
805 // C | 805 // C |
806 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 806 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
807 EngineTestCase.assertSize3(3, superinterfacesOfC); | 807 EngineTestCase.assertSizeOfSet(3, superinterfacesOfC); |
808 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 808 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
809 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 809 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
810 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 810 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
811 } | 811 } |
812 | 812 |
813 void test_creation() { | 813 void test_creation() { |
814 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); | 814 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); |
815 } | 815 } |
816 | 816 |
817 void test_getAccessors() { | 817 void test_getAccessors() { |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2911 ClassDeclaration nodeB = elementB.node; | 2911 ClassDeclaration nodeB = elementB.node; |
2912 JUnitTestCase.assertNotNull(nodeB); | 2912 JUnitTestCase.assertNotNull(nodeB); |
2913 JUnitTestCase.assertEquals("B", nodeB.name.name); | 2913 JUnitTestCase.assertEquals("B", nodeB.name.name); |
2914 JUnitTestCase.assertSame(elementB, nodeB.element); | 2914 JUnitTestCase.assertSame(elementB, nodeB.element); |
2915 } | 2915 } |
2916 } | 2916 } |
2917 | 2917 |
2918 void test_hasNonFinalField_false_const() { | 2918 void test_hasNonFinalField_false_const() { |
2919 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2919 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
2920 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, true, classA.type)]; | 2920 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, true, classA.type)]; |
2921 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2921 JUnitTestCase.assertFalse(classA.hasNonFinalField); |
2922 } | 2922 } |
2923 | 2923 |
2924 void test_hasNonFinalField_false_final() { | 2924 void test_hasNonFinalField_false_final() { |
2925 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2925 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
2926 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, true
, false, classA.type)]; | 2926 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, true
, false, classA.type)]; |
2927 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2927 JUnitTestCase.assertFalse(classA.hasNonFinalField); |
2928 } | 2928 } |
2929 | 2929 |
2930 void test_hasNonFinalField_false_recursive() { | 2930 void test_hasNonFinalField_false_recursive() { |
2931 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2931 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
2932 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2932 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
2933 classA.supertype = classB.type; | 2933 classA.supertype = classB.type; |
2934 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2934 JUnitTestCase.assertFalse(classA.hasNonFinalField); |
2935 } | 2935 } |
2936 | 2936 |
2937 void test_hasNonFinalField_true_immediate() { | 2937 void test_hasNonFinalField_true_immediate() { |
2938 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2938 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
2939 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; | 2939 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
2940 JUnitTestCase.assertTrue(classA.hasNonFinalField()); | 2940 JUnitTestCase.assertTrue(classA.hasNonFinalField); |
2941 } | 2941 } |
2942 | 2942 |
2943 void test_hasNonFinalField_true_inherited() { | 2943 void test_hasNonFinalField_true_inherited() { |
2944 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2944 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
2945 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2945 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
2946 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; | 2946 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
2947 JUnitTestCase.assertTrue(classB.hasNonFinalField()); | 2947 JUnitTestCase.assertTrue(classB.hasNonFinalField); |
2948 } | 2948 } |
2949 | 2949 |
2950 void test_lookUpGetter_declared() { | 2950 void test_lookUpGetter_declared() { |
2951 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2951 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
2952 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2952 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
2953 String getterName = "g"; | 2953 String getterName = "g"; |
2954 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); | 2954 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); |
2955 classA.accessors = <PropertyAccessorElement> [getter]; | 2955 classA.accessors = <PropertyAccessorElement> [getter]; |
2956 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; | 2956 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; |
2957 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library)); | 2957 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library)); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3363 | 3363 |
3364 void test_getElement() { | 3364 void test_getElement() { |
3365 FunctionElementImpl typeElement = new FunctionElementImpl.con1(AstFactory.id
entifier3("f")); | 3365 FunctionElementImpl typeElement = new FunctionElementImpl.con1(AstFactory.id
entifier3("f")); |
3366 FunctionTypeImpl type = new FunctionTypeImpl.con1(typeElement); | 3366 FunctionTypeImpl type = new FunctionTypeImpl.con1(typeElement); |
3367 JUnitTestCase.assertEquals(typeElement, type.element); | 3367 JUnitTestCase.assertEquals(typeElement, type.element); |
3368 } | 3368 } |
3369 | 3369 |
3370 void test_getNamedParameterTypes() { | 3370 void test_getNamedParameterTypes() { |
3371 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(AstFactory.identifier3("f"))); | 3371 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(AstFactory.identifier3("f"))); |
3372 Map<String, Type2> types = type.namedParameterTypes; | 3372 Map<String, Type2> types = type.namedParameterTypes; |
3373 EngineTestCase.assertSize2(0, types); | 3373 EngineTestCase.assertSizeOfMap(0, types); |
3374 } | 3374 } |
3375 | 3375 |
3376 void test_getNormalParameterTypes() { | 3376 void test_getNormalParameterTypes() { |
3377 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(AstFactory.identifier3("f"))); | 3377 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(AstFactory.identifier3("f"))); |
3378 List<Type2> types = type.normalParameterTypes; | 3378 List<Type2> types = type.normalParameterTypes; |
3379 EngineTestCase.assertLength(0, types); | 3379 EngineTestCase.assertLength(0, types); |
3380 } | 3380 } |
3381 | 3381 |
3382 void test_getReturnType() { | 3382 void test_getReturnType() { |
3383 Type2 expectedReturnType = VoidTypeImpl.instance; | 3383 Type2 expectedReturnType = VoidTypeImpl.instance; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3757 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(AstFactory.identifier3("D"))); | 3757 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(AstFactory.identifier3("D"))); |
3758 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); | 3758 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); |
3759 JUnitTestCase.assertEquals(argumentType, result.returnType); | 3759 JUnitTestCase.assertEquals(argumentType, result.returnType); |
3760 List<Type2> normalParameters = result.normalParameterTypes; | 3760 List<Type2> normalParameters = result.normalParameterTypes; |
3761 EngineTestCase.assertLength(1, normalParameters); | 3761 EngineTestCase.assertLength(1, normalParameters); |
3762 JUnitTestCase.assertEquals(argumentType, normalParameters[0]); | 3762 JUnitTestCase.assertEquals(argumentType, normalParameters[0]); |
3763 List<Type2> optionalParameters = result.optionalParameterTypes; | 3763 List<Type2> optionalParameters = result.optionalParameterTypes; |
3764 EngineTestCase.assertLength(1, optionalParameters); | 3764 EngineTestCase.assertLength(1, optionalParameters); |
3765 JUnitTestCase.assertEquals(argumentType, optionalParameters[0]); | 3765 JUnitTestCase.assertEquals(argumentType, optionalParameters[0]); |
3766 Map<String, Type2> namedParameters = result.namedParameterTypes; | 3766 Map<String, Type2> namedParameters = result.namedParameterTypes; |
3767 EngineTestCase.assertSize2(1, namedParameters); | 3767 EngineTestCase.assertSizeOfMap(1, namedParameters); |
3768 JUnitTestCase.assertEquals(argumentType, namedParameters[namedParameterName]
); | 3768 JUnitTestCase.assertEquals(argumentType, namedParameters[namedParameterName]
); |
3769 } | 3769 } |
3770 | 3770 |
3771 void test_substitute2_notEqual() { | 3771 void test_substitute2_notEqual() { |
3772 Type2 returnType = new InterfaceTypeImpl.con1(new ClassElementImpl(AstFactor
y.identifier3("R"))); | 3772 Type2 returnType = new InterfaceTypeImpl.con1(new ClassElementImpl(AstFactor
y.identifier3("R"))); |
3773 Type2 normalParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(
AstFactory.identifier3("A"))); | 3773 Type2 normalParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(
AstFactory.identifier3("A"))); |
3774 Type2 optionalParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l(AstFactory.identifier3("B"))); | 3774 Type2 optionalParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l(AstFactory.identifier3("B"))); |
3775 Type2 namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(A
stFactory.identifier3("C"))); | 3775 Type2 namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(A
stFactory.identifier3("C"))); |
3776 FunctionElementImpl functionElement = new FunctionElementImpl.con1(AstFactor
y.identifier3("f")); | 3776 FunctionElementImpl functionElement = new FunctionElementImpl.con1(AstFactor
y.identifier3("f")); |
3777 String namedParameterName = "c"; | 3777 String namedParameterName = "c"; |
3778 functionElement.parameters = <ParameterElement> [ | 3778 functionElement.parameters = <ParameterElement> [ |
3779 ElementFactory.requiredParameter2("a", normalParameterType), | 3779 ElementFactory.requiredParameter2("a", normalParameterType), |
3780 ElementFactory.positionalParameter2("b", optionalParameterType), | 3780 ElementFactory.positionalParameter2("b", optionalParameterType), |
3781 ElementFactory.namedParameter2(namedParameterName, namedParameterType)]; | 3781 ElementFactory.namedParameter2(namedParameterName, namedParameterType)]; |
3782 functionElement.returnType = returnType; | 3782 functionElement.returnType = returnType; |
3783 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 3783 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
3784 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(AstFactory.identifier3("D"))); | 3784 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(AstFactory.identifier3("D"))); |
3785 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl(AstFactory.identifier3("E"))); | 3785 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl(AstFactory.identifier3("E"))); |
3786 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); | 3786 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); |
3787 JUnitTestCase.assertEquals(returnType, result.returnType); | 3787 JUnitTestCase.assertEquals(returnType, result.returnType); |
3788 List<Type2> normalParameters = result.normalParameterTypes; | 3788 List<Type2> normalParameters = result.normalParameterTypes; |
3789 EngineTestCase.assertLength(1, normalParameters); | 3789 EngineTestCase.assertLength(1, normalParameters); |
3790 JUnitTestCase.assertEquals(normalParameterType, normalParameters[0]); | 3790 JUnitTestCase.assertEquals(normalParameterType, normalParameters[0]); |
3791 List<Type2> optionalParameters = result.optionalParameterTypes; | 3791 List<Type2> optionalParameters = result.optionalParameterTypes; |
3792 EngineTestCase.assertLength(1, optionalParameters); | 3792 EngineTestCase.assertLength(1, optionalParameters); |
3793 JUnitTestCase.assertEquals(optionalParameterType, optionalParameters[0]); | 3793 JUnitTestCase.assertEquals(optionalParameterType, optionalParameters[0]); |
3794 Map<String, Type2> namedParameters = result.namedParameterTypes; | 3794 Map<String, Type2> namedParameters = result.namedParameterTypes; |
3795 EngineTestCase.assertSize2(1, namedParameters); | 3795 EngineTestCase.assertSizeOfMap(1, namedParameters); |
3796 JUnitTestCase.assertEquals(namedParameterType, namedParameters[namedParamete
rName]); | 3796 JUnitTestCase.assertEquals(namedParameterType, namedParameters[namedParamete
rName]); |
3797 } | 3797 } |
3798 | 3798 |
3799 static dartSuite() { | 3799 static dartSuite() { |
3800 _ut.group('FunctionTypeImplTest', () { | 3800 _ut.group('FunctionTypeImplTest', () { |
3801 _ut.test('test_creation', () { | 3801 _ut.test('test_creation', () { |
3802 final __test = new FunctionTypeImplTest(); | 3802 final __test = new FunctionTypeImplTest(); |
3803 runJUnitTest(__test, __test.test_creation); | 3803 runJUnitTest(__test, __test.test_creation); |
3804 }); | 3804 }); |
3805 _ut.test('test_getElement', () { | 3805 _ut.test('test_getElement', () { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3987 InterfaceTypeImplTest.dartSuite(); | 3987 InterfaceTypeImplTest.dartSuite(); |
3988 TypeParameterTypeImplTest.dartSuite(); | 3988 TypeParameterTypeImplTest.dartSuite(); |
3989 VoidTypeImplTest.dartSuite(); | 3989 VoidTypeImplTest.dartSuite(); |
3990 ClassElementImplTest.dartSuite(); | 3990 ClassElementImplTest.dartSuite(); |
3991 ElementLocationImplTest.dartSuite(); | 3991 ElementLocationImplTest.dartSuite(); |
3992 ElementImplTest.dartSuite(); | 3992 ElementImplTest.dartSuite(); |
3993 HtmlElementImplTest.dartSuite(); | 3993 HtmlElementImplTest.dartSuite(); |
3994 LibraryElementImplTest.dartSuite(); | 3994 LibraryElementImplTest.dartSuite(); |
3995 MultiplyDefinedElementImplTest.dartSuite(); | 3995 MultiplyDefinedElementImplTest.dartSuite(); |
3996 } | 3996 } |
OLD | NEW |