ShouldGenerateFile class

Specifies that the expected output for code generation on the annotated member is to match the file contents.

expectedOutputFileName is resolved relative to the file where this annotation is found.

If partOfCurrent is true, the output file is expected to start with the part of directive that links back to the current file.

If partOf is non-null, the output file is expected to start with the part of directive that links to a given file.

If SOURCE_GEN_TEST_UPDATE_GOLDENS environment variable is set to 1, then instead of the comparison the output file will be generated with whatever content the generator produces plus the appropriate part of directive if any. To do so, on Linux or Mac run the test as:

SOURCE_GEN_TEST_UPDATE_GOLDENS=1 dart test

To update a golden, the directory for its file must exist.

Must be used with testAnnotatedElements.

Inheritance

Constructors

ShouldGenerateFile(String expectedOutputFileName, {bool contains = false, String? partOf, bool partOfCurrent = false, Iterable<String>? configurations, List<String>? expectedLogItems})
const

Properties

configurations Iterable<String>?
finalinherited
contains bool
final
expectedLogItems List<String>
finalinherited
expectedOutputFileName String
final
hashCode int
The hash code for this object.
no setterinherited
partOf String?
final
partOfCurrent bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replaceConfiguration(Iterable<String> newConfiguration) TestExpectation
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited