@@ -34,7 +34,8 @@ void main() {
34
34
exit (1 );
35
35
}
36
36
37
- Package sdkAsPackage = new Package (getSdkLibrariesToDocument (
37
+ Package sdkAsPackage = new Package (
38
+ getSdkLibrariesToDocument (
38
39
testUtils.sdkDir, testUtils.analyzerHelper.context),
39
40
new PackageMeta .fromSdk (sdkDir));
40
41
@@ -93,7 +94,8 @@ void main() {
93
94
Library dartAsyncLib;
94
95
95
96
setUp (() {
96
- dartAsyncLib = new Library (getSdkLibrariesToDocument (
97
+ dartAsyncLib = new Library (
98
+ getSdkLibrariesToDocument (
97
99
testUtils.sdkDir, testUtils.analyzerHelper.context).first,
98
100
sdkAsPackage);
99
101
@@ -224,33 +226,33 @@ void main() {
224
226
});
225
227
226
228
test ('links to a reference to its class' , () {
227
- expect (docsAsHtml, contains (
228
- '<a href="fake/BaseForDocComments-class.html">BaseForDocComments</a>' ));
229
+ expect (
230
+ docsAsHtml,
231
+ contains (
232
+ '<a href="fake/BaseForDocComments-class.html">BaseForDocComments</a>' ));
229
233
});
230
234
231
235
test (
232
236
'links to a reference to a top-level const with multiple underscores' ,
233
237
() {
234
238
expect (
235
- docsAsHtml, contains ('<a href="">NAME_WITH_TWO_UNDERSCORES</a>' ));
236
- }, skip: 'Wait for https://github.com/dart-lang/dartdoc/issues/768' );
237
-
238
- // remove this test when the above is fixed. just here to track when
239
- // the behavior changes
240
- test (
241
- 'literally renders a reference to a top-level const with multiple underscores' ,
242
- () {
243
- expect (docsAsHtml, contains ('[NAME_WITH_TWO_UNDERSCORES]' ));
239
+ docsAsHtml,
240
+ contains (
241
+ '<a href="fake/NAME_WITH_TWO_UNDERSCORES.html">NAME_WITH_TWO_UNDERSCORES</a>' ));
244
242
});
245
243
246
244
test ('links to a method in this class' , () {
247
- expect (docsAsHtml, contains (
248
- '<a href="fake/BaseForDocComments/anotherMethod.html">anotherMethod</a>' ));
245
+ expect (
246
+ docsAsHtml,
247
+ contains (
248
+ '<a href="fake/BaseForDocComments/anotherMethod.html">anotherMethod</a>' ));
249
249
});
250
250
251
251
test ('links to a top-level function in this library' , () {
252
- expect (docsAsHtml, contains (
253
- '<a href="fake/topLevelFunction.html">topLevelFunction</a>' ));
252
+ expect (
253
+ docsAsHtml,
254
+ contains (
255
+ '<a href="fake/topLevelFunction.html">topLevelFunction</a>' ));
254
256
});
255
257
256
258
test ('links to top-level function from an imported library' , () {
@@ -263,34 +265,44 @@ void main() {
263
265
});
264
266
265
267
test ('links to a top-level const from an imported lib' , () {
266
- expect (docsAsHtml, contains (
267
- '<a href="fake/incorrectDocReference.html">incorrectDocReference</a>' ));
268
+ expect (
269
+ docsAsHtml,
270
+ contains (
271
+ '<a href="fake/incorrectDocReference.html">incorrectDocReference</a>' ));
268
272
});
269
273
270
274
test ('links to a top-level variable with a prefix from an imported lib' ,
271
275
() {
272
276
expect (docsAsHtml,
273
277
contains ('<a href="">css.theOnlyThingInTheLibrary</a>' ));
274
- }, skip: 'Wait for https://github.com/dart-lang/dartdoc/issues/767 to be fixed' );
278
+ },
279
+ skip:
280
+ 'Wait for https://github.com/dart-lang/dartdoc/issues/767 to be fixed' );
275
281
276
282
// remove this test when the above test is fixed. just here to
277
283
// track when the behavior changes
278
284
test ('codeifies a prefixed top-level variable an imported lib' , () {
279
- expect (docsAsHtml, contains (
280
- '<code class="prettyprint lang-dart">css.theOnlyThingInTheLibrary</code>' ));
285
+ expect (
286
+ docsAsHtml,
287
+ contains (
288
+ '<code class="prettyprint lang-dart">css.theOnlyThingInTheLibrary</code>' ));
281
289
});
282
290
283
291
test ('links to a name with a single underscore' , () {
284
- expect (docsAsHtml, contains (
285
- '<a href="fake/NAME_SINGLEUNDERSCORE.html">NAME_SINGLEUNDERSCORE</a>' ));
292
+ expect (
293
+ docsAsHtml,
294
+ contains (
295
+ '<a href="fake/NAME_SINGLEUNDERSCORE.html">NAME_SINGLEUNDERSCORE</a>' ));
286
296
});
287
297
});
288
298
289
299
test ('multi-underscore names in brackets do not become italicized' , () {
290
300
expect (short.documentation, contains ('[NAME_WITH_TWO_UNDERSCORES]' ));
291
- expect (short.documentationAsHtml, contains (
292
- '<a href="fake/NAME_WITH_TWO_UNDERSCORES.html">NAME_WITH_TWO_UNDERSCORES</a>' ));
293
- }, skip: 'Wait for https://github.com/dart-lang/dartdoc/issues/768' );
301
+ expect (
302
+ short.documentationAsHtml,
303
+ contains (
304
+ '<a href="fake/NAME_WITH_TWO_UNDERSCORES.html">NAME_WITH_TWO_UNDERSCORES</a>' ));
305
+ });
294
306
295
307
test ('still has brackets inside code blocks' , () {
296
308
expect (topLevelFunction.documentationAsHtml,
@@ -301,17 +313,21 @@ void main() {
301
313
() {
302
314
Method add =
303
315
specialList.allInstanceMethods.firstWhere ((m) => m.name == 'add' );
304
- expect (add.oneLineDoc, equals (
305
- 'Adds <code class="prettyprint lang-dart">value</code> to the end of this list,\n extending the length by one.' ));
316
+ expect (
317
+ add.oneLineDoc,
318
+ equals (
319
+ 'Adds <code class="prettyprint lang-dart">value</code> to the end of this list,\n extending the length by one.' ));
306
320
});
307
321
308
322
test (
309
323
'full documentation references from inherited methods should not have brackets' ,
310
324
() {
311
325
Method add =
312
326
specialList.allInstanceMethods.firstWhere ((m) => m.name == 'add' );
313
- expect (add.documentationAsHtml, startsWith (
314
- '<p>Adds <code class="prettyprint lang-dart">value</code> to the end of this list,\n extending the length by one.' ));
327
+ expect (
328
+ add.documentationAsHtml,
329
+ startsWith (
330
+ '<p>Adds <code class="prettyprint lang-dart">value</code> to the end of this list,\n extending the length by one.' ));
315
331
});
316
332
317
333
test ('incorrect doc references are still wrapped in code blocks' , () {
@@ -330,8 +346,10 @@ void main() {
330
346
});
331
347
332
348
test ('doc ref to class in SDK does not render as link' , () {
333
- expect (thisIsAsync.documentationAsHtml, equals (
334
- '<p>An async function. It should look like I return a <code class="prettyprint lang-dart">Future</code>.</p>' ));
349
+ expect (
350
+ thisIsAsync.documentationAsHtml,
351
+ equals (
352
+ '<p>An async function. It should look like I return a <code class="prettyprint lang-dart">Future</code>.</p>' ));
335
353
});
336
354
337
355
test ('references are correct in exported libraries' , () {
@@ -341,8 +359,10 @@ void main() {
341
359
expect (resolved, isNotNull);
342
360
expect (resolved,
343
361
contains ('<a href="two_exports/BaseClass-class.html">BaseClass</a>' ));
344
- expect (resolved, contains (
345
- 'linking over to <code class="prettyprint lang-dart">Apple</code>.' ));
362
+ expect (
363
+ resolved,
364
+ contains (
365
+ 'linking over to <code class="prettyprint lang-dart">Apple</code>.' ));
346
366
});
347
367
348
368
test ('references to class and constructors' , () {
@@ -351,8 +371,10 @@ void main() {
351
371
contains ('Extends class <a href="ex/Apple-class.html">Apple</a>' ));
352
372
expect (
353
373
comment, contains ('use <a href="ex/Apple/Apple.html">new Apple</a>' ));
354
- expect (comment, contains (
355
- '<a href="ex/Apple/Apple.fromString.html">new Apple.fromString</a>' ));
374
+ expect (
375
+ comment,
376
+ contains (
377
+ '<a href="ex/Apple/Apple.fromString.html">new Apple.fromString</a>' ));
356
378
});
357
379
358
380
test ('reference to class from another library' , () {
@@ -362,13 +384,17 @@ void main() {
362
384
363
385
test ('reference to method' , () {
364
386
String comment = foo2.documentationAsHtml;
365
- expect (comment, equals (
366
- '<p>link to method from class <a href="ex/Apple/m.html">Apple.m</a></p>' ));
387
+ expect (
388
+ comment,
389
+ equals (
390
+ '<p>link to method from class <a href="ex/Apple/m.html">Apple.m</a></p>' ));
367
391
});
368
392
369
393
test ('legacy code blocks render correctly' , () {
370
- expect (testingCodeSyntaxInOneLiners.oneLineDoc, equals (
371
- 'These are code syntaxes: <code class="prettyprint lang-dart">true</code> and <code class="prettyprint lang-dart">false</code>' ));
394
+ expect (
395
+ testingCodeSyntaxInOneLiners.oneLineDoc,
396
+ equals (
397
+ 'These are code syntaxes: <code class="prettyprint lang-dart">true</code> and <code class="prettyprint lang-dart">false</code>' ));
372
398
});
373
399
374
400
test ('doc comments to parameters are marked as code' , () {
@@ -493,8 +519,8 @@ void main() {
493
519
494
520
test ('exported class should have linkedReturnType for the current library' ,
495
521
() {
496
- Method toUTC = DT .instanceMethods. firstWhere ((m) => m.name == 'toUtc' ,
497
- orElse: () => null );
522
+ Method toUTC = DT .instanceMethods
523
+ . firstWhere ((m) => m.name == 'toUtc' , orElse: () => null );
498
524
expect (toUTC, isNotNull);
499
525
expect (toUTC.linkedReturnType,
500
526
equals ('<a href="ex/DateTime-class.html">DateTime</a>' ));
@@ -626,19 +652,25 @@ void main() {
626
652
test ('async function' , () {
627
653
expect (thisIsAsync.isAsynchronous, isTrue);
628
654
expect (thisIsAsync.linkedReturnType, equals ('Future' ));
629
- expect (thisIsAsync.documentation, equals (
630
- 'An async function. It should look like I return a [Future].' ));
631
- expect (thisIsAsync.documentationAsHtml, equals (
632
- '<p>An async function. It should look like I return a <code class="prettyprint lang-dart">Future</code>.</p>' ));
655
+ expect (
656
+ thisIsAsync.documentation,
657
+ equals (
658
+ 'An async function. It should look like I return a [Future].' ));
659
+ expect (
660
+ thisIsAsync.documentationAsHtml,
661
+ equals (
662
+ '<p>An async function. It should look like I return a <code class="prettyprint lang-dart">Future</code>.</p>' ));
633
663
});
634
664
635
665
test ('docs do not lose brackets in code blocks' , () {
636
666
expect (topLevelFunction.documentation, contains ("['hello from dart']" ));
637
667
});
638
668
639
669
test ('has source code' , () {
640
- expect (topLevelFunction.sourceCode, startsWith (
641
- '/// Top-level function 3 params and 1 optional positional param.' ));
670
+ expect (
671
+ topLevelFunction.sourceCode,
672
+ startsWith (
673
+ '/// Top-level function 3 params and 1 optional positional param.' ));
642
674
expect (topLevelFunction.sourceCode, endsWith ('''
643
675
String topLevelFunction(int param1, bool param2, Cool coolBeans,
644
676
[double optionalPositional = 0.0]) {
@@ -658,7 +690,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
658
690
fakeLibrary.classes.singleWhere ((c) => c.name == 'HasGenerics' );
659
691
m = classB.instanceMethods.first;
660
692
isGreaterThan = exLibrary.classes
661
- .singleWhere ((c) => c.name == 'Apple' ).instanceMethods
693
+ .singleWhere ((c) => c.name == 'Apple' )
694
+ .instanceMethods
662
695
.singleWhere ((m) => m.name == 'isGreaterThan' );
663
696
m4 = classB.instanceMethods[1 ];
664
697
m5 = klass.instanceMethods.singleWhere ((m) => m.name == 'another' );
@@ -722,8 +755,9 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
722
755
onlySetter = LongFirstLine .instanceProperties
723
756
.firstWhere ((p) => p.name == 'onlySetter' );
724
757
725
- lengthX = fakeLibrary.classes.firstWhere (
726
- (c) => c.name == 'WithGetterAndSetter' ).allInstanceProperties
758
+ lengthX = fakeLibrary.classes
759
+ .firstWhere ((c) => c.name == 'WithGetterAndSetter' )
760
+ .allInstanceProperties
727
761
.firstWhere ((c) => c.name == 'lengthX' );
728
762
});
729
763
@@ -857,7 +891,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
857
891
858
892
setUp (() {
859
893
fList = exLibrary.classes
860
- .firstWhere ((c) => c.name == 'B' ).instanceProperties
894
+ .firstWhere ((c) => c.name == 'B' )
895
+ .instanceProperties
861
896
.singleWhere ((p) => p.name == 'list' );
862
897
});
863
898
@@ -894,7 +929,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
894
929
isGreaterThan =
895
930
c.instanceMethods.singleWhere ((m) => m.name == 'isGreaterThan' );
896
931
asyncM = exLibrary.classes
897
- .firstWhere ((c) => c.name == 'Dog' ).instanceMethods
932
+ .firstWhere ((c) => c.name == 'Dog' )
933
+ .instanceMethods
898
934
.firstWhere ((m) => m.name == 'foo' );
899
935
intNumber = isGreaterThan.parameters.first;
900
936
intCheckOptional = isGreaterThan.parameters.last;
@@ -1007,8 +1043,10 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1007
1043
() => expect (forAnnotation.annotations, hasLength (1 )));
1008
1044
1009
1045
test ('has the right annotation' , () {
1010
- expect (forAnnotation.annotations.first, equals (
1011
- '<a href="ex/ForAnnotation-class.html">ForAnnotation</a>(\' my value\' )' ));
1046
+ expect (
1047
+ forAnnotation.annotations.first,
1048
+ equals (
1049
+ '<a href="ex/ForAnnotation-class.html">ForAnnotation</a>(\' my value\' )' ));
1012
1050
});
1013
1051
1014
1052
test ('methods has the right annotation' , () {
0 commit comments