2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- import 'package:analyzer/file_system/memory_file_system.dart' ;
6
5
import 'package:dartdoc/src/model/model.dart' ;
7
- import 'package:dartdoc/src/package_config_provider.dart' ;
8
- import 'package:dartdoc/src/package_meta.dart' ;
9
6
import 'package:test/test.dart' ;
7
+ import 'package:test_reflective_loader/test_reflective_loader.dart' ;
10
8
11
- import 'src/test_descriptor_utils .dart' as d ;
9
+ import 'dartdoc_test_base .dart' ;
12
10
import 'src/utils.dart' ;
13
11
14
12
void main () {
15
- const libraryName = 'annotations' ;
16
-
17
- const dartCoreUrlPrefix = 'https://api.dart.dev/stable/2.16.0/dart-core' ;
18
-
19
- late PackageMetaProvider packageMetaProvider;
20
- late MemoryResourceProvider resourceProvider;
21
- late FakePackageConfigProvider packageConfigProvider;
22
- late String packagePath;
23
-
24
- setUp (() async {
25
- packageMetaProvider = testPackageMetaProvider;
26
- resourceProvider =
27
- packageMetaProvider.resourceProvider as MemoryResourceProvider ;
28
-
29
- packagePath = await d.createPackage (
30
- libraryName,
31
- pubspec: '''
32
- name: annotations
33
- version: 0.0.1
34
- environment:
35
- sdk: '>=2.15.0 <3.0.0'
36
- ''' ,
37
- resourceProvider: resourceProvider,
38
- );
39
-
40
- packageConfigProvider =
41
- getTestPackageConfigProvider (packageMetaProvider.defaultSdkDir.path);
42
- packageConfigProvider.addPackageToConfigFor (
43
- packagePath, libraryName, Uri .file ('$packagePath /' ));
13
+ defineReflectiveSuite (() {
14
+ defineReflectiveTests (AnnotationTest );
44
15
});
16
+ }
45
17
46
- Future <Library > bootPackageWithLibrary (String libraryContent) async {
47
- await d.dir ('lib' , [
48
- d.file ('lib.dart' , '''
49
- library $libraryName ;
50
-
51
- $libraryContent
52
- ''' ),
53
- ]).createInMemory (resourceProvider, packagePath);
54
-
55
- var packageGraph = await bootBasicPackage (
56
- packagePath,
57
- packageMetaProvider,
58
- packageConfigProvider,
59
- );
60
- return packageGraph.libraries.named (libraryName);
61
- }
18
+ @reflectiveTest
19
+ class AnnotationTest extends DartdocTestBase {
20
+ @override
21
+ final libraryName = 'annotations' ;
62
22
63
- test ( 'deprecated constant is linked' , () async {
23
+ void test_deprecatedConstant () async {
64
24
var library = await bootPackageWithLibrary ('''
65
25
@deprecated
66
26
int value = 0;
@@ -76,9 +36,9 @@ int value = 0;
76
36
annotation.linkedNameWithParameters,
77
37
'@<a href="$dartCoreUrlPrefix /deprecated-constant.html">deprecated</a>' ,
78
38
);
79
- });
39
+ }
80
40
81
- test ( 'Deprecated() constructor call is linked' , () async {
41
+ void test_DeprecatedConstructorCall () async {
82
42
var library = await bootPackageWithLibrary ('''
83
43
@Deprecated('text')
84
44
int value = 0;
@@ -95,9 +55,9 @@ int value = 0;
95
55
'@<a href="$dartCoreUrlPrefix /Deprecated-class.html">Deprecated</a>'
96
56
'('text')' ,
97
57
);
98
- });
58
+ }
99
59
100
- test ( 'locally declared constant is linked' , () async {
60
+ void test_locallyDeclaredConstant () async {
101
61
var library = await bootPackageWithLibrary ('''
102
62
class MyAnnotation {
103
63
const MyAnnotation();
@@ -121,9 +81,9 @@ int value = 0;
121
81
'@<a href="${htmlBasePlaceholder }annotations/myAnnotation-constant.html">'
122
82
'myAnnotation</a>' ,
123
83
);
124
- });
84
+ }
125
85
126
- test ( 'locally declared constructor call is linked' , () async {
86
+ void test_locallyDeclaredConstructorCall () async {
127
87
var library = await bootPackageWithLibrary ('''
128
88
class MyAnnotation {
129
89
const MyAnnotation(bool b);
@@ -145,9 +105,9 @@ int value = 0;
145
105
'@<a href="${htmlBasePlaceholder }annotations/MyAnnotation-class.html">'
146
106
'MyAnnotation</a>(true)' ,
147
107
);
148
- });
108
+ }
149
109
150
- test ( 'generic constructor call is linked' , () async {
110
+ void test_genericConstructorCall () async {
151
111
var library = await bootPackageWithLibrary ('''
152
112
class Ann<T> {
153
113
final T f;
@@ -172,5 +132,5 @@ int value = 0;
172
132
'<span class="signature"><<wbr><span class="type-parameter">'
173
133
'<a href="$dartCoreUrlPrefix /bool-class.html">bool</a></span>></span>(true)' ,
174
134
);
175
- });
135
+ }
176
136
}
0 commit comments