saveForExtension method
Future<void>
saveForExtension({
- required ExtensionElement extElement,
- required ElementAnnotation annotation,
- required CompilationUnit compilationUnit,
- required ExtensionDeclaration extAstNode,
- required PubspecData pubspecData,
- required File extFile,
- required TestRunInfo testRunInfo,
Implementation
Future<void> saveForExtension(
{required ExtensionElement extElement,
required ElementAnnotation annotation,
required CompilationUnit compilationUnit,
required ExtensionDeclaration extAstNode,
required PubspecData pubspecData,
required File extFile,
required TestRunInfo testRunInfo}) async {
final List<String> excludedMethods = annotation.excludeMethods;
final fileImport =
'package:${pubspecData.packageName}/${PathUtils.relatetiveLibFilePath(extFile.path)}';
final methodAstNodes = await extElement.getMethodDeclarations;
List<Future> saveFutures = [];
for (int i = 0; i < methodAstNodes.entries.length; i++) {
final method = methodAstNodes.entries.elementAt(i);
saveFutures.add(_saveTestsForMethod(
method: method,
compilationUnit: compilationUnit,
extAstNode: extAstNode,
fileImport: fileImport,
excludedMethods: excludedMethods,
subjectFile: extFile,
testRunInfo: testRunInfo,
className: extElement.displayName,
methodAstNodes: methodAstNodes));
}
await Future.wait(saveFutures);
}