testDataCases function Null safety

void testDataCases(
  1. {required String directory,
  2. String extension = 'unit',
  3. bool recursive = true,
  4. required void testBody(
    1. DataCase dataCase
    )}
)

Declare a test for each data case found in directory, using testBody as the test body, with each data case passed to testBody.

directory, extension, and recursive all act the same as in dataCases.

A test will be skipped if it's description starts with "skip:".

Implementation

void testDataCases(
    {required String directory,
    String extension = 'unit',
    bool recursive = true,
    required void Function(DataCase dataCase) testBody}) {
  for (var dataCase in dataCases(
      directory: directory, extension: extension, recursive: recursive)) {
    test(dataCase.description, () => testBody(dataCase), skip: dataCase.skip);
  }
}