test static method

Future<void> test(
  1. String path
)

Implementation

static Future<void> test(String path) async {
  path = 'app/' + path;

  if (path.contains('.dart')) {
    var entity = File(libPath(path));
    if (!entity.existsSync()) {
      output.error('File $path not exist');
      exit(1);
    }
    await _generateTest(entity,
        File(libPath(path).replaceFirst('lib/', 'test/').replaceFirst('.dart', '_test.dart')));
  } else {
    var entity = Directory(libPath(path));
    if (!entity.existsSync()) {
      output.error('Directory $path not exist');
      exit(1);
    }

    for (var file in entity.listSync()) {
      if (file is File) {
        await _generateTest(
          file,
          File(
            file.path.replaceFirst('lib/', 'test/').replaceFirst('.dart', '_test.dart'),
          ),
        );
      }
    }
  }
}