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

Side by Side Diff: pkg/analyzer/test/generated/element_test.dart

Issue 243263004: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/test/generated/ast_test.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 // C 696 // C
697 // 697 //
698 ClassElement classA = ElementFactory.classElement2("A", []); 698 ClassElement classA = ElementFactory.classElement2("A", []);
699 ClassElement classB = ElementFactory.classElement("B", classA.type, []); 699 ClassElement classB = ElementFactory.classElement("B", classA.type, []);
700 ClassElement classC = ElementFactory.classElement("C", classB.type, []); 700 ClassElement classC = ElementFactory.classElement("C", classB.type, []);
701 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat hToObject(classA.type)); 701 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat hToObject(classA.type));
702 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat hToObject(classB.type)); 702 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat hToObject(classB.type));
703 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat hToObject(classC.type)); 703 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat hToObject(classC.type));
704 } 704 }
705 705
706 void test_computeSuperinterfaceSet_genericInterfacePath() {
707 //
708 // A
709 // | implements
710 // B<T>
711 // | implements
712 // C<T>
713 //
714 // D
715 //
716 ClassElementImpl classA = ElementFactory.classElement2("A", []);
717 ClassElementImpl classB = ElementFactory.classElement2("B", ["T"]);
718 ClassElementImpl classC = ElementFactory.classElement2("C", ["T"]);
719 ClassElement classD = ElementFactory.classElement2("D", []);
720 InterfaceType typeA = classA.type;
721 classB.interfaces = <InterfaceType> [typeA];
722 InterfaceTypeImpl typeBT = new InterfaceTypeImpl.con1(classB);
723 DartType typeT = classC.type.typeArguments[0];
724 typeBT.typeArguments = <DartType> [typeT];
725 classC.interfaces = <InterfaceType> [typeBT];
726 // A
727 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf aceSet(typeA);
728 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA);
729 InterfaceType typeObject = ElementFactory.object.type;
730 JUnitTestCase.assertTrue(superinterfacesOfA.contains(typeObject));
731 // B<D>
732 InterfaceTypeImpl typeBD = new InterfaceTypeImpl.con1(classB);
733 typeBD.typeArguments = <DartType> [classD.type];
734 Set<InterfaceType> superinterfacesOfBD = InterfaceTypeImpl.computeSuperinter faceSet(typeBD);
735 EngineTestCase.assertSizeOfSet(2, superinterfacesOfBD);
736 JUnitTestCase.assertTrue(superinterfacesOfBD.contains(typeObject));
737 JUnitTestCase.assertTrue(superinterfacesOfBD.contains(typeA));
738 // C<D>
739 InterfaceTypeImpl typeCD = new InterfaceTypeImpl.con1(classC);
740 typeCD.typeArguments = <DartType> [classD.type];
741 Set<InterfaceType> superinterfacesOfCD = InterfaceTypeImpl.computeSuperinter faceSet(typeCD);
742 EngineTestCase.assertSizeOfSet(3, superinterfacesOfCD);
743 JUnitTestCase.assertTrue(superinterfacesOfCD.contains(typeObject));
744 JUnitTestCase.assertTrue(superinterfacesOfCD.contains(typeA));
745 JUnitTestCase.assertTrue(superinterfacesOfCD.contains(typeBD));
746 }
747
748 void test_computeSuperinterfaceSet_genericSuperclassPath() {
749 //
750 // A
751 // |
752 // B<T>
753 // |
754 // C<T>
755 //
756 // D
757 //
758 ClassElement classA = ElementFactory.classElement2("A", []);
759 InterfaceType typeA = classA.type;
760 ClassElement classB = ElementFactory.classElement("B", typeA, ["T"]);
761 ClassElementImpl classC = ElementFactory.classElement2("C", ["T"]);
762 InterfaceTypeImpl typeBT = new InterfaceTypeImpl.con1(classB);
763 DartType typeT = classC.type.typeArguments[0];
764 typeBT.typeArguments = <DartType> [typeT];
765 classC.supertype = typeBT;
766 ClassElement classD = ElementFactory.classElement2("D", []);
767 // A
768 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf aceSet(typeA);
769 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA);
770 InterfaceType typeObject = ElementFactory.object.type;
771 JUnitTestCase.assertTrue(superinterfacesOfA.contains(typeObject));
772 // B<D>
773 InterfaceTypeImpl typeBD = new InterfaceTypeImpl.con1(classB);
774 typeBD.typeArguments = <DartType> [classD.type];
775 Set<InterfaceType> superinterfacesOfBD = InterfaceTypeImpl.computeSuperinter faceSet(typeBD);
776 EngineTestCase.assertSizeOfSet(2, superinterfacesOfBD);
777 JUnitTestCase.assertTrue(superinterfacesOfBD.contains(typeObject));
778 JUnitTestCase.assertTrue(superinterfacesOfBD.contains(typeA));
779 // C<D>
780 InterfaceTypeImpl typeCD = new InterfaceTypeImpl.con1(classC);
781 typeCD.typeArguments = <DartType> [classD.type];
782 Set<InterfaceType> superinterfacesOfCD = InterfaceTypeImpl.computeSuperinter faceSet(typeCD);
783 EngineTestCase.assertSizeOfSet(3, superinterfacesOfCD);
784 JUnitTestCase.assertTrue(superinterfacesOfCD.contains(typeObject));
785 JUnitTestCase.assertTrue(superinterfacesOfCD.contains(typeA));
786 JUnitTestCase.assertTrue(superinterfacesOfCD.contains(typeBD));
787 }
788
706 void test_computeSuperinterfaceSet_multipleInterfacePaths() { 789 void test_computeSuperinterfaceSet_multipleInterfacePaths() {
707 ClassElementImpl classA = ElementFactory.classElement2("A", []); 790 ClassElementImpl classA = ElementFactory.classElement2("A", []);
708 ClassElementImpl classB = ElementFactory.classElement2("B", []); 791 ClassElementImpl classB = ElementFactory.classElement2("B", []);
709 ClassElementImpl classC = ElementFactory.classElement2("C", []); 792 ClassElementImpl classC = ElementFactory.classElement2("C", []);
710 ClassElementImpl classD = ElementFactory.classElement2("D", []); 793 ClassElementImpl classD = ElementFactory.classElement2("D", []);
711 ClassElementImpl classE = ElementFactory.classElement2("E", []); 794 ClassElementImpl classE = ElementFactory.classElement2("E", []);
712 classB.interfaces = <InterfaceType> [classA.type]; 795 classB.interfaces = <InterfaceType> [classA.type];
713 classC.interfaces = <InterfaceType> [classA.type]; 796 classC.interfaces = <InterfaceType> [classA.type];
714 classD.interfaces = <InterfaceType> [classC.type]; 797 classD.interfaces = <InterfaceType> [classC.type];
715 classE.interfaces = <InterfaceType> [classB.type, classD.type]; 798 classE.interfaces = <InterfaceType> [classB.type, classD.type];
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 void test_getLeastUpperBound_typeParameters_different() { 1216 void test_getLeastUpperBound_typeParameters_different() {
1134 // 1217 //
1135 // class List<int> 1218 // class List<int>
1136 // class List<double> 1219 // class List<double>
1137 // 1220 //
1138 InterfaceType listType = _typeProvider.listType; 1221 InterfaceType listType = _typeProvider.listType;
1139 InterfaceType intType = _typeProvider.intType; 1222 InterfaceType intType = _typeProvider.intType;
1140 InterfaceType doubleType = _typeProvider.doubleType; 1223 InterfaceType doubleType = _typeProvider.doubleType;
1141 InterfaceType listOfIntType = listType.substitute4(<DartType> [intType]); 1224 InterfaceType listOfIntType = listType.substitute4(<DartType> [intType]);
1142 InterfaceType listOfDoubleType = listType.substitute4(<DartType> [doubleType ]); 1225 InterfaceType listOfDoubleType = listType.substitute4(<DartType> [doubleType ]);
1143 JUnitTestCase.assertEquals(listType.substitute4(<DartType> [_typeProvider.dy namicType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); 1226 JUnitTestCase.assertEquals(_typeProvider.objectType, listOfIntType.getLeastU pperBound(listOfDoubleType));
1144 } 1227 }
1145 1228
1146 void test_getLeastUpperBound_typeParameters_same() { 1229 void test_getLeastUpperBound_typeParameters_same() {
1147 // 1230 //
1148 // List<int> 1231 // List<int>
1149 // List<int> 1232 // List<int>
1150 // 1233 //
1151 InterfaceType listType = _typeProvider.listType; 1234 InterfaceType listType = _typeProvider.listType;
1152 InterfaceType intType = _typeProvider.intType; 1235 InterfaceType intType = _typeProvider.intType;
1153 InterfaceType listOfIntType = listType.substitute4(<DartType> [intType]); 1236 InterfaceType listOfIntType = listType.substitute4(<DartType> [intType]);
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_r ecursion); 2075 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_r ecursion);
1993 }); 2076 });
1994 _ut.test('test_computeLongestInheritancePathToObject_singleInterfacePath', () { 2077 _ut.test('test_computeLongestInheritancePathToObject_singleInterfacePath', () {
1995 final __test = new InterfaceTypeImplTest(); 2078 final __test = new InterfaceTypeImplTest();
1996 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s ingleInterfacePath); 2079 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s ingleInterfacePath);
1997 }); 2080 });
1998 _ut.test('test_computeLongestInheritancePathToObject_singleSuperclassPath' , () { 2081 _ut.test('test_computeLongestInheritancePathToObject_singleSuperclassPath' , () {
1999 final __test = new InterfaceTypeImplTest(); 2082 final __test = new InterfaceTypeImplTest();
2000 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s ingleSuperclassPath); 2083 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s ingleSuperclassPath);
2001 }); 2084 });
2085 _ut.test('test_computeSuperinterfaceSet_genericInterfacePath', () {
2086 final __test = new InterfaceTypeImplTest();
2087 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_genericInterfa cePath);
2088 });
2089 _ut.test('test_computeSuperinterfaceSet_genericSuperclassPath', () {
2090 final __test = new InterfaceTypeImplTest();
2091 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_genericSupercl assPath);
2092 });
2002 _ut.test('test_computeSuperinterfaceSet_multipleInterfacePaths', () { 2093 _ut.test('test_computeSuperinterfaceSet_multipleInterfacePaths', () {
2003 final __test = new InterfaceTypeImplTest(); 2094 final __test = new InterfaceTypeImplTest();
2004 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleInterf acePaths); 2095 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleInterf acePaths);
2005 }); 2096 });
2006 _ut.test('test_computeSuperinterfaceSet_multipleSuperclassPaths', () { 2097 _ut.test('test_computeSuperinterfaceSet_multipleSuperclassPaths', () {
2007 final __test = new InterfaceTypeImplTest(); 2098 final __test = new InterfaceTypeImplTest();
2008 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleSuperc lassPaths); 2099 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleSuperc lassPaths);
2009 }); 2100 });
2010 _ut.test('test_computeSuperinterfaceSet_recursion', () { 2101 _ut.test('test_computeSuperinterfaceSet_recursion', () {
2011 final __test = new InterfaceTypeImplTest(); 2102 final __test = new InterfaceTypeImplTest();
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 InterfaceTypeImplTest.dartSuite(); 4151 InterfaceTypeImplTest.dartSuite();
4061 TypeParameterTypeImplTest.dartSuite(); 4152 TypeParameterTypeImplTest.dartSuite();
4062 VoidTypeImplTest.dartSuite(); 4153 VoidTypeImplTest.dartSuite();
4063 ClassElementImplTest.dartSuite(); 4154 ClassElementImplTest.dartSuite();
4064 ElementLocationImplTest.dartSuite(); 4155 ElementLocationImplTest.dartSuite();
4065 ElementImplTest.dartSuite(); 4156 ElementImplTest.dartSuite();
4066 HtmlElementImplTest.dartSuite(); 4157 HtmlElementImplTest.dartSuite();
4067 LibraryElementImplTest.dartSuite(); 4158 LibraryElementImplTest.dartSuite();
4068 MultiplyDefinedElementImplTest.dartSuite(); 4159 MultiplyDefinedElementImplTest.dartSuite();
4069 } 4160 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/ast_test.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698