@@ -686,7 +686,7 @@ void main() {
686686 });
687687
688688 test ('correctly finds all the classes' , () {
689- expect (classes, hasLength (21 ));
689+ expect (classes, hasLength (22 ));
690690 });
691691
692692 test ('abstract' , () {
@@ -1027,9 +1027,10 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
10271027 });
10281028
10291029 group ('Method' , () {
1030- Class classB, klass, HasGenerics , Cat , CatString ;
1030+ Class classB, klass, HasGenerics , Cat , CatString , TypedFunctionsWithoutTypedefs ;
10311031 Method m1, isGreaterThan, m4, m5, m6, m7, convertToMap, abstractMethod;
10321032 Method inheritedClear, testGeneric, testGenericMethod;
1033+ Method getAFunctionReturningVoid;
10331034
10341035 setUp (() {
10351036 klass = exLibrary.classes.singleWhere ((c) => c.name == 'Klass' );
@@ -1061,6 +1062,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
10611062 .singleWhere ((m) => m.name == 'testGenericMethod' );
10621063 convertToMap = HasGenerics .instanceMethods
10631064 .singleWhere ((m) => m.name == 'convertToMap' );
1065+ TypedFunctionsWithoutTypedefs = exLibrary.classes.singleWhere ((c) => c.name == 'TypedFunctionsWithoutTypedefs' );
1066+ getAFunctionReturningVoid = TypedFunctionsWithoutTypedefs .instanceMethods.singleWhere ((m) => m.name == 'getAFunctionReturningVoid' );
10641067 });
10651068
10661069 tearDown (() {
@@ -1070,6 +1073,15 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
10701073 }
10711074 });
10721075
1076+ test ('verify parameters to types are displayed' , () {
1077+ var matcher = new RegExp ('Function\\ (<span class="parameter" id="getAFunctionReturningVoid-param-"><span class="type-annotation">T.</span></span> <span class="parameter" id="getAFunctionReturningVoid-param-"><span class="type-annotation">T.</span></span>\\ )' );
1078+ expect (matcher.hasMatch (getAFunctionReturningVoid.linkedReturnType), isTrue);
1079+ });
1080+
1081+ test ('verify parameter types are correctly displayed' , () {
1082+ expect (getAFunctionReturningVoid.linkedReturnType, equals ('Function(<span class="parameter" id="getAFunctionReturningVoid-param-"><span class="type-annotation">T1</span></span> <span class="parameter" id="getAFunctionReturningVoid-param-"><span class="type-annotation">T2</span></span>)' ));
1083+ }, skip: 'blocked on https://github.com/dart-lang/sdk/issues/30146' );
1084+
10731085 test ('has a fully qualified name' , () {
10741086 expect (m1.fullyQualifiedName, 'ex.B.m1' );
10751087 });
@@ -1757,13 +1769,26 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
17571769 group ('Typedef' , () {
17581770 Typedef t;
17591771 Typedef generic;
1772+ Typedef aComplexTypedef;
17601773
17611774 setUp (() {
17621775 t = exLibrary.typedefs.firstWhere ((t) => t.name == 'processMessage' );
17631776 generic =
17641777 fakeLibrary.typedefs.firstWhere ((t) => t.name == 'NewGenericTypedef' );
1778+ aComplexTypedef = exLibrary.typedefs.firstWhere ((t) => t.name == 'aComplexTypedef' );
17651779 });
17661780
1781+ test ('anonymous nested functions inside typedefs are handled' , () {
1782+ expect (aComplexTypedef, isNotNull);
1783+ expect (aComplexTypedef.linkedReturnType, startsWith ('Function' ));
1784+ expect (aComplexTypedef.nameWithGenerics, equals ('aComplexTypedef<A1, A2, A3>' ));
1785+ });
1786+
1787+ test ('anonymous nested functions inside typedefs are handled correctly' , () {
1788+ expect (aComplexTypedef.linkedReturnType, equals ('Function(<span class="parameter" id="-param-"><span class="type-annotation">A1</span></span> <span class="parameter" id="-param-"><span class="type-annotation">A2</span></span> <span class="parameter" id="-param-"><span class="type-annotation">A3</span></span>)' ));
1789+ expect (aComplexTypedef.linkedParamsLines, equals ('<span class="parameter" id="aComplexTypedef-param-"><span class="type-annotation">A3</span></span> <span class="parameter" id="aComplexTypedef-param-"><span class="type-annotation">String</span></span>' ));
1790+ }, skip: 'blocked on https://github.com/dart-lang/sdk/issues/30146' );
1791+
17671792 test ('has a fully qualified name' , () {
17681793 expect (t.fullyQualifiedName, 'ex.processMessage' );
17691794 expect (generic.fullyQualifiedName, 'fake.NewGenericTypedef' );
0 commit comments