@@ -20,13 +20,38 @@ void main() {
2020
2121@reflectiveTest
2222class TypedefTest extends DartdocTestBase {
23+ @override
24+ List <String > get experiments => ['inline-class' ];
25+
2326 @override
2427 String get libraryName => 'typedefs' ;
2528
2629 @override
27- String get sdkConstraint => '>=3.0.0 <4.0.0' ;
30+ String get sdkConstraint => '>=3.3.0 <4.0.0' ;
31+
32+ void test_class_basic () async {
33+ var library = await bootPackageWithLibrary ('''
34+ class C {}
35+ typedef T = C;
36+ ''' );
37+ final tTypedef = library.typedefs.named ('T' );
38+ expect (tTypedef.nameWithGenerics, 'T' );
39+ expect (tTypedef.genericParameters, '' );
40+ expect (tTypedef.aliasedType, isA <InterfaceType >());
41+ }
42+
43+ void test_extensionType_basic () async {
44+ var library = await bootPackageWithLibrary ('''
45+ extension type E(int i) {}
46+ typedef T = E;
47+ ''' );
48+ final tTypedef = library.typedefs.named ('T' );
49+ expect (tTypedef.nameWithGenerics, 'T' );
50+ expect (tTypedef.genericParameters, '' );
51+ expect (tTypedef.aliasedType, isA <InterfaceType >());
52+ }
2853
29- void test_basicFunctionTypedef () async {
54+ void test_function_basic () async {
3055 var library = await bootPackageWithLibrary ('''
3156/// Line _one_.
3257///
@@ -52,7 +77,7 @@ Line _two_.''');
5277<p>Line <em>two</em>.</p>''' );
5378 }
5479
55- void test_genericFunctionTypedef () async {
80+ void test_function_generic () async {
5681 var library = await bootPackageWithLibrary ('''
5782typedef Cb2<T> = T Function(T);
5883''' );
@@ -69,7 +94,7 @@ typedef Cb2<T> = T Function(T);
6994 expect (cb2Typedef.aliasedType, isA <FunctionType >());
7095 }
7196
72- void test_genericFunctionTypedefReferringToGenericTypedef () async {
97+ void test_function_generic_referringToGenericTypedef () async {
7398 var library = await bootPackageWithLibrary ('''
7499typedef Cb2<T> = T Function(T);
75100
@@ -92,7 +117,7 @@ typedef Cb3<T> = Cb2<List<T>>;
92117 // TODO(srawlins): Dramatically improve typedef testing.
93118 }
94119
95- void test_typedefInDocCommentReference () async {
120+ void test_inDocCommentReference () async {
96121 var library = await bootPackageWithLibrary ('''
97122typedef Cb2<T> = T Function(T);
98123
@@ -111,7 +136,39 @@ typedef Cb3<T> = Cb2<List<T>>;
111136 );
112137 }
113138
114- void test_basicRecordTypedef () async {
139+ void test_inDocCommentReference2 () async {
140+ var library = await bootPackageWithLibrary ('''
141+ typedef R2<T> = (T, String);
142+
143+ /// Not unlike [R2].
144+ typedef R3<T> = R2<List<T>>;
145+ ''' );
146+ final r3Typedef = library.typedefs.named ('R3' );
147+
148+ expect (r3Typedef.isDocumented, isTrue);
149+
150+ expect (r3Typedef.documentation, 'Not unlike [R2].' );
151+
152+ expect (
153+ r3Typedef.documentationAsHtml,
154+ '<p>Not unlike '
155+ '<a href="%%__HTMLBASE_dartdoc_internal__%%typedefs/R2.html">R2</a>.'
156+ '</p>' ,
157+ );
158+ }
159+
160+ void test_mixin_basic () async {
161+ var library = await bootPackageWithLibrary ('''
162+ mixin M {}
163+ typedef T = M;
164+ ''' );
165+ final tTypedef = library.typedefs.named ('T' );
166+ expect (tTypedef.nameWithGenerics, 'T' );
167+ expect (tTypedef.genericParameters, '' );
168+ expect (tTypedef.aliasedType, isA <InterfaceType >());
169+ }
170+
171+ void test_record_basic () async {
115172 var library = await bootPackageWithLibrary ('''
116173/// Line _one_.
117174///
@@ -137,7 +194,7 @@ Line _two_.''');
137194<p>Line <em>two</em>.</p>''' );
138195 }
139196
140- void test_genericRecordTypedef () async {
197+ void test_record_generic () async {
141198 var library = await bootPackageWithLibrary ('''
142199typedef R2<T> = (T, String);
143200''' );
@@ -154,7 +211,7 @@ typedef R2<T> = (T, String);
154211 expect (r2Typedef.aliasedType, isA <RecordType >());
155212 }
156213
157- void test_genericRecordTypedefReferringToGenericTypedef () async {
214+ void test_record_generic_referringToGenericTypedef () async {
158215 var library = await bootPackageWithLibrary ('''
159216typedef R2<T> = (T, String);
160217
@@ -174,28 +231,7 @@ typedef R3<T> = R2<List<T>>;
174231 expect (r3Typedef.aliasedType, isA <RecordType >());
175232 }
176233
177- void test_typedefInDocCommentReference2 () async {
178- var library = await bootPackageWithLibrary ('''
179- typedef R2<T> = (T, String);
180-
181- /// Not unlike [R2].
182- typedef R3<T> = R2<List<T>>;
183- ''' );
184- final r3Typedef = library.typedefs.named ('R3' );
185-
186- expect (r3Typedef.isDocumented, isTrue);
187-
188- expect (r3Typedef.documentation, 'Not unlike [R2].' );
189-
190- expect (
191- r3Typedef.documentationAsHtml,
192- '<p>Not unlike '
193- '<a href="%%__HTMLBASE_dartdoc_internal__%%typedefs/R2.html">R2</a>.'
194- '</p>' ,
195- );
196- }
197-
198- void test_typedefRetainsAliasWhenUsed () async {
234+ void test_retainsAliasWhenUsed () async {
199235 var library = await bootPackageWithLibrary ('''
200236typedef R<T> = (T, String);
201237
0 commit comments