source_gen_test
library
Classes
ShouldGenerate
Specifies the expected output for code generation on the annotated member.
ShouldThrow
Specifies that an InvalidGenerationSourceError
is expected to be thrown
when running generation for the annotated member.
Functions
clearBuildLog ()
→ void
generateForElement <T > (GeneratorForAnnotation<T > generator , LibraryReader libraryReader , String name )
→ Future <String >
initializeBuildLogTracking ()
→ void
Initializes tracking of build
events from log
for every test in the
current context.
initializeLibraryReader (Map <String , String > contentMap , String targetLibraryFileName )
→ Future <LibraryReader >
Returns a LibraryReader
for library specified by targetLibraryFileName
using the file contents described by contentMap
.
initializeLibraryReaderForDirectory (String sourceDirectory , String targetLibraryFileName )
→ Future <LibraryReader >
Returns a LibraryReader
for library specified by targetLibraryFileName
using the files in sourceDirectory
.
testAnnotatedElements <T > (LibraryReader libraryReader , GeneratorForAnnotation<T > defaultGenerator , {Map <String , GeneratorForAnnotation<T > > ? additionalGenerators , Iterable <String > ? expectedAnnotatedTests , Iterable <String > ? defaultConfiguration })
→ void
If defaultConfiguration
is not provided or null
, "default" and the keys
from additionalGenerators
(if provided) are used.
throwsInvalidGenerationSourceError (Object messageMatcher , {Object ? todoMatcher , Object ? elementMatcher })
→ Matcher
Returns a Matcher
that matches a thrown InvalidGenerationSourceError
with InvalidGenerationSourceError.message
that matches messageMatcher
,
and InvalidGenerationSourceError.todo
that matches todoMatcher
and
InvalidGenerationSourceError.element
that isNotNull
.