testAnnotatedElements<T> function

void testAnnotatedElements<T>(
  1. LibraryReader libraryReader,
  2. GeneratorForAnnotation<T> defaultGenerator, {
  3. Map<String, GeneratorForAnnotation<T>>? additionalGenerators,
  4. Iterable<String>? expectedAnnotatedTests,
  5. Iterable<String>? defaultConfiguration,
})

If defaultConfiguration is not provided or null, "default" and the keys from additionalGenerators (if provided) are used.

Tests registered by this function assume initializeBuildLogTracking has been called.

If expectedAnnotatedTests is provided, it should contain the names of the members in libraryReader that are annotated for testing. If the same element is annotated for multiple tests, it should appear in the list the same number of times.

Implementation

void testAnnotatedElements<T>(
  LibraryReader libraryReader,
  GeneratorForAnnotation<T> defaultGenerator, {
  Map<String, GeneratorForAnnotation<T>>? additionalGenerators,
  Iterable<String>? expectedAnnotatedTests,
  Iterable<String>? defaultConfiguration,
}) {
  for (var entry in getAnnotatedClasses<T>(
    libraryReader,
    defaultGenerator,
    additionalGenerators: additionalGenerators,
    expectedAnnotatedTests: expectedAnnotatedTests,
    defaultConfiguration: defaultConfiguration,
  )) {
    entry._registerTest();
  }
}