@@ -686,7 +686,7 @@ void main() {
686
686
});
687
687
688
688
test ('correctly finds all the classes' , () {
689
- expect (classes, hasLength (21 ));
689
+ expect (classes, hasLength (22 ));
690
690
});
691
691
692
692
test ('abstract' , () {
@@ -1027,9 +1027,10 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1027
1027
});
1028
1028
1029
1029
group ('Method' , () {
1030
- Class classB, klass, HasGenerics , Cat , CatString ;
1030
+ Class classB, klass, HasGenerics , Cat , CatString , TypedFunctionsWithoutTypedefs ;
1031
1031
Method m1, isGreaterThan, m4, m5, m6, m7, convertToMap, abstractMethod;
1032
1032
Method inheritedClear, testGeneric, testGenericMethod;
1033
+ Method getAFunctionReturningVoid;
1033
1034
1034
1035
setUp (() {
1035
1036
klass = exLibrary.classes.singleWhere ((c) => c.name == 'Klass' );
@@ -1061,6 +1062,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1061
1062
.singleWhere ((m) => m.name == 'testGenericMethod' );
1062
1063
convertToMap = HasGenerics .instanceMethods
1063
1064
.singleWhere ((m) => m.name == 'convertToMap' );
1065
+ TypedFunctionsWithoutTypedefs = exLibrary.classes.singleWhere ((c) => c.name == 'TypedFunctionsWithoutTypedefs' );
1066
+ getAFunctionReturningVoid = TypedFunctionsWithoutTypedefs .instanceMethods.singleWhere ((m) => m.name == 'getAFunctionReturningVoid' );
1064
1067
});
1065
1068
1066
1069
tearDown (() {
@@ -1070,6 +1073,15 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1070
1073
}
1071
1074
});
1072
1075
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
+
1073
1085
test ('has a fully qualified name' , () {
1074
1086
expect (m1.fullyQualifiedName, 'ex.B.m1' );
1075
1087
});
@@ -1757,13 +1769,26 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1757
1769
group ('Typedef' , () {
1758
1770
Typedef t;
1759
1771
Typedef generic;
1772
+ Typedef aComplexTypedef;
1760
1773
1761
1774
setUp (() {
1762
1775
t = exLibrary.typedefs.firstWhere ((t) => t.name == 'processMessage' );
1763
1776
generic =
1764
1777
fakeLibrary.typedefs.firstWhere ((t) => t.name == 'NewGenericTypedef' );
1778
+ aComplexTypedef = exLibrary.typedefs.firstWhere ((t) => t.name == 'aComplexTypedef' );
1765
1779
});
1766
1780
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
+
1767
1792
test ('has a fully qualified name' , () {
1768
1793
expect (t.fullyQualifiedName, 'ex.processMessage' );
1769
1794
expect (generic.fullyQualifiedName, 'fake.NewGenericTypedef' );
0 commit comments