generateForGlobalExeculatbleElement method

Future<void> generateForGlobalExeculatbleElement({
  1. required ExecutableElement methodElement,
  2. required FunctionDeclaration methodAstNode,
  3. required CompilationUnit compilationUnit,
  4. required ElementAnnotation annotation,
  5. required PubspecData pubspecData,
  6. required File methodFile,
  7. required TestRunInfo testRunInfo,
  8. required bool dryrun,
  9. required bool testcases,
  10. required bool testability,
})

Implementation

Future<void> generateForGlobalExeculatbleElement({
  required ExecutableElement methodElement,
  required FunctionDeclaration methodAstNode,
  required CompilationUnit compilationUnit,
  required ElementAnnotation annotation,
  required PubspecData pubspecData,
  required File methodFile,
  required TestRunInfo testRunInfo,
  required bool dryrun,
  required bool testcases,
  required bool testability,
}) async {
  final List<String> excludedMethods = annotation.excludeMethods;
  final fileImport =
      'package:${pubspecData.packageName}/${PathUtils.relatetiveLibFilePath(methodFile.path)}';
  if (dryrun) {
    await _dryrunForMethod(
      method: MapEntry(methodElement.displayName, methodAstNode),
      compilationUnit: compilationUnit,
      fileImport: fileImport,
      excludedMethods: excludedMethods,
    );
  } else if (testability) {
    await _testabilityForMethod(
      method: MapEntry(methodElement.displayName, methodAstNode),
      compilationUnit: compilationUnit,
      fileImport: fileImport,
      excludedMethods: excludedMethods,
    );
  } else if (testcases) {
    await _testcasesForMethod(
      method: MapEntry(methodElement.displayName, methodAstNode),
      compilationUnit: compilationUnit,
      fileImport: fileImport,
      subjectFile: methodFile,
      excludedMethods: excludedMethods,
    );
  } else {
    await _generateTestsForMethod(
        method: MapEntry(methodElement.displayName, methodAstNode),
        compilationUnit: compilationUnit,
        fileImport: fileImport,
        excludedMethods: excludedMethods,
        subjectFile: methodFile,
        testRunInfo: testRunInfo);
  }
}