@@ -45,8 +45,8 @@ void main() {
45
45
expect (package.name, 'test_package' );
46
46
});
47
47
48
- test ('libraries' , () {
49
- expect (package.libraries, hasLength (7 ));
48
+ test ('has all the libraries' , () {
49
+ expect (package.libraries, hasLength (8 ));
50
50
});
51
51
52
52
test ('is documented in library' , () {
@@ -482,11 +482,12 @@ void main() {
482
482
List <Class > classes;
483
483
Class Apple , B , Cat , Cool , Dog , F , Dep , SpecialList ;
484
484
Class ExtendingClass , CatString ;
485
- Class Helper , CoolFromExporter ;
485
+ Class Helper , CoolFromExporter , ExportedClass ;
486
486
487
487
setUp (() {
488
488
classes = exLibrary.classes;
489
489
CoolFromExporter = classes.firstWhere ((c) => c.name == 'Cool' );
490
+ ExportedClass = classes.firstWhere ((c) => c.name == 'ExportedClass' );
490
491
Helper = classes.firstWhere ((c) => c.name == 'Helper' );
491
492
Apple = classes.firstWhere ((c) => c.name == 'Apple' );
492
493
B = classes.firstWhere ((c) => c.name == 'B' );
@@ -529,7 +530,7 @@ void main() {
529
530
});
530
531
531
532
test ('correctly finds all the classes' , () {
532
- expect (classes, hasLength (18 ));
533
+ expect (classes, hasLength (19 ));
533
534
});
534
535
535
536
test ('abstract' , () {
@@ -619,20 +620,27 @@ void main() {
619
620
});
620
621
621
622
test (
622
- 'exported class from a src library should have linkedName with a link to the exporting class library' ,
623
- () {
623
+ 'exported class from a src library should have linkedName with a '
624
+ 'link to the exporting class library' , () {
624
625
expect (Helper .linkedName, startsWith ('<a href="ex' ));
625
626
});
626
627
627
628
test (
628
- 'exported class from a public library should have linkedName with a link to origin library' ,
629
- () {
629
+ 'exported class from a public library should have linkedName '
630
+ 'with a link to origin library' , () {
630
631
expect (Cool .linkedName, startsWith ('<a href="fake/' ));
631
632
});
632
633
633
634
test (
634
- 'exported class from a public library two levels deep should have linkedName with a link to origin library' ,
635
- () {
635
+ 'exported class, without a show, from a public library '
636
+ 'should have linkedName with a link to origin library' , () {
637
+ expect (ExportedClass .linkedName,
638
+ startsWith ('<a href="to_be_exported/ExportedClass' ));
639
+ });
640
+
641
+ test (
642
+ 'exported class from a public library two levels deep should have '
643
+ 'linkedName with a link to origin library' , () {
636
644
expect (CoolFromExporter .linkedName, startsWith ('<a href="fake/Cool' ));
637
645
});
638
646
@@ -718,10 +726,33 @@ void main() {
718
726
});
719
727
720
728
group ('Enum' , () {
721
- Enum animal;
729
+ Enum animal, Color , ExportedEnum ;
722
730
723
731
setUp (() {
724
732
animal = exLibrary.enums.firstWhere ((e) => e.name == 'Animal' );
733
+ Color = exLibrary.enums.firstWhere ((e) => e.name == 'Color' );
734
+ ExportedEnum =
735
+ exLibrary.enums.firstWhere ((e) => e.name == 'ExportedEnum' );
736
+ });
737
+
738
+ test (
739
+ 'exported enum with a show from a public library should have '
740
+ 'linkedName with a link to origin library' , () {
741
+ expect (Color .linkedName, startsWith ('<a href="fake/Color' ));
742
+ });
743
+
744
+ test (
745
+ 'exported enum without a show from a public library should '
746
+ 'have linkedName '
747
+ 'with a link to origin library' , () {
748
+ expect (ExportedEnum .linkedName,
749
+ startsWith ('<a href="to_be_exported/ExportedEnum' ));
750
+ });
751
+
752
+ test (
753
+ 'should have linkedName '
754
+ 'with a link to this library' , () {
755
+ expect (animal.linkedName, startsWith ('<a href="ex/Animal' ));
725
756
});
726
757
727
758
test ('has a fully qualified name' , () {
@@ -765,10 +796,12 @@ void main() {
765
796
ModelFunction f1;
766
797
ModelFunction thisIsAsync;
767
798
ModelFunction topLevelFunction;
768
- ModelFunction short, helperFunction;
799
+ ModelFunction short, helperFunction, exportedFunction ;
769
800
770
801
setUp (() {
771
802
short = exLibrary.functions.firstWhere ((f) => f.name == 'short' );
803
+ exportedFunction =
804
+ exLibrary.functions.firstWhere ((f) => f.name == 'exportedFunction' );
772
805
helperFunction =
773
806
exLibrary.functions.firstWhere ((f) => f.name == 'helperFunction' );
774
807
f1 = exLibrary.functions.firstWhere ((f) => f.name == 'function1' );
@@ -779,9 +812,16 @@ void main() {
779
812
});
780
813
781
814
test (
782
- 'exported function from a public library should have linkedName with a link to origin library' ,
783
- () {
784
- expect (short.linkedName, startsWith ('<a href="fake/' ));
815
+ 'exported function with a show from a public library should have '
816
+ 'linkedName with a link to origin library' , () {
817
+ expect (short.linkedName, startsWith ('<a href="fake/short' ));
818
+ });
819
+
820
+ test (
821
+ 'exported function without a show from a public library should have '
822
+ 'linkedName with a link to origin library' , () {
823
+ expect (exportedFunction.linkedName,
824
+ startsWith ('<a href="to_be_exported/exportedFunction' ));
785
825
});
786
826
787
827
test (
@@ -1172,7 +1212,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1172
1212
group ('Top-level Variable' , () {
1173
1213
TopLevelVariable v;
1174
1214
TopLevelVariable v3, justGetter, justSetter;
1175
- TopLevelVariable setAndGet, mapWithDynamicKeys, topLevelVar;
1215
+ TopLevelVariable setAndGet, mapWithDynamicKeys, topLevelVar, exportedField ;
1176
1216
1177
1217
setUp (() {
1178
1218
v = exLibrary.properties.firstWhere ((p) => p.name == 'number' );
@@ -1187,6 +1227,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1187
1227
.firstWhere ((p) => p.name == 'mapWithDynamicKeys' );
1188
1228
topLevelVar =
1189
1229
exLibrary.properties.firstWhere ((p) => p.name == 'topLevelVar' );
1230
+ exportedField =
1231
+ exLibrary.properties.firstWhere ((p) => p.name == 'exportedField' );
1190
1232
});
1191
1233
1192
1234
test ('has a fully qualified name' , () {
@@ -1201,11 +1243,16 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1201
1243
equals ('String' ));
1202
1244
});
1203
1245
1204
- test ('linkedName for exported variable has origin library' , () {
1246
+ test ('linkedName for exported variable via show has origin library' , () {
1205
1247
expect (mapWithDynamicKeys.linkedName,
1206
1248
contains ('href="fake/mapWithDynamicKeys.html"' ));
1207
1249
});
1208
1250
1251
+ test ('linkedName for exported variable via show has origin library' , () {
1252
+ expect (exportedField.linkedName,
1253
+ contains ('href="to_be_exported/exportedField.html"' ));
1254
+ });
1255
+
1209
1256
test (
1210
1257
'linkedName for exported variable from private library has exported library' ,
1211
1258
() {
@@ -1216,8 +1263,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1216
1263
expect (v.enclosingElement.name, equals (exLibrary.name));
1217
1264
});
1218
1265
1219
- test ('found six properties' , () {
1220
- expect (exLibrary.properties, hasLength (7 ));
1266
+ test ('found eight properties' , () {
1267
+ expect (exLibrary.properties, hasLength (8 ));
1221
1268
});
1222
1269
1223
1270
test ('linked return type is a double' , () {
@@ -1359,13 +1406,15 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1359
1406
});
1360
1407
1361
1408
group ('Typedef' , () {
1362
- Typedef t, FakeProcesses , DoThing ;
1409
+ Typedef t, FakeProcesses , DoThing , ExportedTypeDef ;
1363
1410
1364
1411
setUp (() {
1365
1412
t = exLibrary.typedefs.firstWhere ((t) => t.name == 'processMessage' );
1366
1413
FakeProcesses =
1367
1414
exLibrary.typedefs.firstWhere ((t) => t.name == 'FakeProcesses' );
1368
1415
DoThing = exLibrary.typedefs.firstWhere ((t) => t.name == 'DoThing' );
1416
+ ExportedTypeDef =
1417
+ exLibrary.typedefs.firstWhere ((t) => t.name == 'ExportedTypeDef' );
1369
1418
});
1370
1419
1371
1420
test ('has a fully qualified name' , () {
@@ -1384,11 +1433,16 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
1384
1433
expect (t.linkedReturnType, equals ('String' ));
1385
1434
});
1386
1435
1387
- test ('linkedName for exported typedef is origin library' , () {
1436
+ test ('linkedName for exported via show typedef is origin library' , () {
1388
1437
expect (
1389
1438
FakeProcesses .linkedName, contains ('href="fake/FakeProcesses.html"' ));
1390
1439
});
1391
1440
1441
+ test ('linkedName for exported without show typedef is origin library' , () {
1442
+ expect (ExportedTypeDef .linkedName,
1443
+ contains ('href="to_be_exported/ExportedTypeDef.html"' ));
1444
+ });
1445
+
1392
1446
test ('linkedName for private exported typedef is exporting library' , () {
1393
1447
expect (DoThing .linkedName, contains ('href="ex/DoThing.html"' ));
1394
1448
});
0 commit comments