@@ -66,6 +66,7 @@ class VerifyTests {
66
66
void _buildTestsIn (
67
67
AnalysisSession session, String testDirPath, Folder directory) {
68
68
var testFileNames = < String > [];
69
+ var testFilePaths = < String > [];
69
70
File ? testAllFile;
70
71
var children = directory.getChildren ();
71
72
children
@@ -83,6 +84,7 @@ class VerifyTests {
83
84
testAllFile = child;
84
85
} else if (name.endsWith ('_test.dart' ) && ! isExpensive (child)) {
85
86
testFileNames.add (name);
87
+ testFilePaths.add (child.path);
86
88
}
87
89
}
88
90
}
@@ -126,6 +128,7 @@ class VerifyTests {
126
128
if (missingFiles.isNotEmpty) {
127
129
fail ('Tests missing from "test_all.dart": ${missingFiles .join (', ' )}' );
128
130
}
131
+
129
132
var extraImports = < String > [];
130
133
for (var importedFile in importedFiles) {
131
134
if (! testFileNames.contains (importedFile) &&
@@ -136,6 +139,30 @@ class VerifyTests {
136
139
if (extraImports.isNotEmpty) {
137
140
fail ('Extra tests in "test_all.dart": ${extraImports .join (', ' )}' );
138
141
}
142
+
143
+ for (var testFilePath in testFilePaths) {
144
+ var result = session.getParsedUnit (testFilePath);
145
+ if (result is ! ParsedUnitResult ) {
146
+ fail ('Could not parse $testFilePath ' );
147
+ }
148
+ for (var declaration in result.unit.declarations) {
149
+ if (declaration is ClassDeclaration ) {
150
+ for (var member in declaration.members) {
151
+ if (member is MethodDeclaration ) {
152
+ var name = member.name.lexeme;
153
+ if (name.startsWith ('solo_test_' )) {
154
+ fail ("Solo test: $name in '$testFilePath '" );
155
+ }
156
+ for (var annotation in member.metadata) {
157
+ if (annotation.name.name == 'soloTest' ) {
158
+ fail ("Solo test: $name in '$testFilePath '" );
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
139
166
});
140
167
}
141
168
}
0 commit comments