@@ -20,8 +20,48 @@ void main() {
20
20
class ParameterTest extends DartdocTestBase {
21
21
@override
22
22
String get libraryName => 'parameters' ;
23
- @override
24
- String get sdkConstraint => '>=2.17.0 <3.0.0' ;
23
+
24
+ void test_formalParameter_referenced () async {
25
+ var library = await bootPackageWithLibrary ('''
26
+ /// Text [p].
27
+ void f(int p) {}
28
+ ''' );
29
+ var f = library.functions.named ('f' );
30
+ // There is no link, but also no wrong link or crash.
31
+ expect (f.documentationAsHtml, '<p>Text <code>p</code>.</p>' );
32
+ }
33
+
34
+ void test_formalParameter_referenced_notShadowedElement () async {
35
+ var library = await bootPackageWithLibrary ('''
36
+ /// Text [p].
37
+ void f(int p) {}
38
+ var p = 0;
39
+ ''' );
40
+ var f = library.functions.named ('f' );
41
+ // There is no link, but also no wrong link or crash.
42
+ expect (f.documentationAsHtml, '<p>Text <code>p</code>.</p>' );
43
+ }
44
+
45
+ void test_formalParameter_referenced_notShadowedPrefix () async {
46
+ var library = await bootPackageWithLibrary ('''
47
+ import 'dart:async' as p;
48
+ /// Text [p].
49
+ void f(int p) {}
50
+ ''' );
51
+ var f = library.functions.named ('f' );
52
+ // There is no link, but also no wrong link or crash.
53
+ expect (f.documentationAsHtml, '<p>Text <code>p</code>.</p>' );
54
+ }
55
+
56
+ void test_formalParameter_referenced_wildcard () async {
57
+ var library = await bootPackageWithLibrary ('''
58
+ /// Text [_].
59
+ void f(int _) {}
60
+ ''' );
61
+ var f = library.functions.named ('f' );
62
+ // There is no link, but also no wrong link or crash.
63
+ expect (f.documentationAsHtml, '<p>Text <code>_</code>.</p>' );
64
+ }
25
65
26
66
void test_formalParameter_generic_method () async {
27
67
var library = await bootPackageWithLibrary ('''
@@ -203,7 +243,48 @@ class A {
203
243
''' ));
204
244
}
205
245
206
- void test_superConstructorParameter_fieldFormal () async {
246
+ void test_fieldFormalParameter_referenced () async {
247
+ var library = await bootPackageWithLibrary ('''
248
+ class C {
249
+ int p;
250
+ /// Text [p].
251
+ C(this.p);
252
+ }
253
+ ''' );
254
+ var cConstructor = library.classes.named ('C' ).constructors.named ('C' );
255
+ // There is no link, but also no wrong link or crash.
256
+ expect (cConstructor.documentationAsHtml, '<p>Text <code>p</code>.</p>' );
257
+ }
258
+
259
+ void test_fieldFormalParameter_referenced_wildcard () async {
260
+ var library = await bootPackageWithLibrary ('''
261
+ class C {
262
+ int _;
263
+ /// Text [_].
264
+ C(this._);
265
+ }
266
+ ''' );
267
+ var cConstructor = library.classes.named ('C' ).constructors.named ('C' );
268
+ // There is no link, but also no wrong link or crash.
269
+ expect (cConstructor.documentationAsHtml, '<p>Text <code>_</code>.</p>' );
270
+ }
271
+
272
+ void test_superParameter_referenced_wildcard () async {
273
+ var library = await bootPackageWithLibrary ('''
274
+ class C {
275
+ C(int _);
276
+ }
277
+ class D extends C {
278
+ /// Text [_].
279
+ D(super._) {}
280
+ }
281
+ ''' );
282
+ var dConstructor = library.classes.named ('D' ).constructors.named ('D' );
283
+ // There is no link, but also no wrong link or crash.
284
+ expect (dConstructor.documentationAsHtml, '<p>Text <code>_</code>.</p>' );
285
+ }
286
+
287
+ void test_superParameter_fieldFormal () async {
207
288
var library = await bootPackageWithLibrary ('''
208
289
class C {
209
290
int f;
@@ -225,7 +306,7 @@ class D extends C {
225
306
''' ));
226
307
}
227
308
228
- void test_superConstructorParameter_isSubtype () async {
309
+ void test_superParameter_isSubtype () async {
229
310
var library = await bootPackageWithLibrary ('''
230
311
class C {
231
312
C.positionalNum(num g);
@@ -246,7 +327,7 @@ class D extends C {
246
327
''' ));
247
328
}
248
329
249
- void test_superConstructorParameter_superParameter () async {
330
+ void test_superParameter_superParameter () async {
250
331
var library = await bootPackageWithLibrary ('''
251
332
class C {
252
333
C.requiredPositional(int a);
0 commit comments