File tree Expand file tree Collapse file tree 4 files changed +50
-11
lines changed
testing/test_package/lib/src Expand file tree Collapse file tree 4 files changed +50
-11
lines changed Original file line number Diff line number Diff line change @@ -32,33 +32,33 @@ class Category
32
32
@override
33
33
final DartdocOptionContext config;
34
34
35
- final List <Class > _classes = [] ;
35
+ final Set <Class > _classes = {} ;
36
36
37
- final List <Class > _exceptions = [] ;
37
+ final Set <Class > _exceptions = {} ;
38
38
39
39
@override
40
- final List <TopLevelVariable > constants = [] ;
40
+ final Set <TopLevelVariable > constants = {} ;
41
41
42
42
@override
43
- final List <Extension > extensions = [] ;
43
+ final Set <Extension > extensions = {} ;
44
44
45
45
@override
46
- final List <ExtensionType > extensionTypes = [] ;
46
+ final Set <ExtensionType > extensionTypes = {} ;
47
47
48
48
@override
49
- final List <Enum > enums = [] ;
49
+ final Set <Enum > enums = {} ;
50
50
51
51
@override
52
- final List <ModelFunction > functions = [] ;
52
+ final Set <ModelFunction > functions = {} ;
53
53
54
54
@override
55
- final List <Mixin > mixins = [] ;
55
+ final Set <Mixin > mixins = {} ;
56
56
57
57
@override
58
- final List <TopLevelVariable > properties = [] ;
58
+ final Set <TopLevelVariable > properties = {} ;
59
59
60
60
@override
61
- final List <Typedef > typedefs = [] ;
61
+ final Set <Typedef > typedefs = {} ;
62
62
63
63
final CategoryDefinition _categoryDefinition;
64
64
Original file line number Diff line number Diff line change @@ -393,6 +393,25 @@ void main() {
393
393
expect (SubForDocComments .categories.first.isDocumented, isFalse);
394
394
expect (SubForDocComments .displayedCategories, isEmpty);
395
395
});
396
+
397
+ test ('No duplicate entries' , () {
398
+ final categories = ginormousPackageGraph.localPackages
399
+ .firstWhere ((p) => p.name == 'test_package' )
400
+ .categories;
401
+ for (final c in categories) {
402
+ expect (c.classes.length, equals (c.classes.toSet ().length));
403
+ expect (c.exceptions.length, equals (c.exceptions.toSet ().length));
404
+ expect (c.extensions.length, equals (c.extensions.toSet ().length));
405
+ expect (
406
+ c.extensionTypes.length, equals (c.extensionTypes.toSet ().length));
407
+ expect (c.enums.length, equals (c.enums.toSet ().length));
408
+ expect (c.mixins.length, equals (c.mixins.toSet ().length));
409
+ expect (c.constants.length, equals (c.constants.toSet ().length));
410
+ expect (c.properties.length, equals (c.properties.toSet ().length));
411
+ expect (c.functions.length, equals (c.functions.toSet ().length));
412
+ expect (c.typedefs.length, equals (c.typedefs.toSet ().length));
413
+ }
414
+ });
396
415
});
397
416
398
417
group ('Package' , () {
Original file line number Diff line number Diff line change @@ -125,7 +125,9 @@ extension type ExType(int it) {}
125
125
''' ),
126
126
d.file ('other.dart' , '''
127
127
/// {@category Documented}
128
- library;
128
+ library;
129
+
130
+ export 'lib.dart' show C1, E1;
129
131
''' ),
130
132
],
131
133
files: [
@@ -229,6 +231,15 @@ library;
229
231
);
230
232
});
231
233
234
+ test ('classes are not duplicated' , () async {
235
+ expect (
236
+ topicOneLines
237
+ .where ((l) => l.contains ('<a href="../lib/C1-class.html">C1</a>' )),
238
+ // Once in the sidebar and once in the main body
239
+ hasLength (2 ),
240
+ );
241
+ });
242
+
232
243
test ('sidebar contains enums' , () async {
233
244
expect (
234
245
topicOneLines,
@@ -240,6 +251,14 @@ library;
240
251
);
241
252
});
242
253
254
+ test ('enums are not duplicated' , () async {
255
+ expect (
256
+ topicOneLines.where ((l) => l.contains ('<a href="../lib/E1.html">E1</a>' )),
257
+ // Once in the sidebar and once in the main body
258
+ hasLength (2 ),
259
+ );
260
+ });
261
+
243
262
test ('sidebar contains mixins' , () async {
244
263
expect (
245
264
topicOneLines,
Original file line number Diff line number Diff line change 1
1
library reexport.somelib;
2
2
3
+ /// {@category Unreal}
3
4
class SomeClass {}
4
5
5
6
class SomeOtherClass {}
You can’t perform that action at this time.
0 commit comments