AnalysisRuleTest class abstract

A base class for analysis rule tests that use test_reflective_loader.

Constructors

AnalysisRuleTest()

Properties

addFixnumPackageDep bool
Adds the 'fixnum' package as a dependency to the package-under-test.
no setterinherited
addFlutterLocalizationsPackageDep bool
Adds the 'flutter_localizations' package as a dependency to the package-under-test.
no setterinherited
addFlutterPackageDep bool
Adds the 'flutter' package as a dependency to the package-under-test.
no setterinherited
addFlutterTestPackageDep bool
Adds the 'flutter_test' package as a dependency to the package-under-test.
no setterinherited
addMetaPackageDep bool
Adds the 'meta' package as a dependency to the package-under-test.
no setterinherited
addTestReflectiveLoaderPackageDep bool
Adds the 'test_reflective_loader' package as a dependency to the package-under-test.
no setterinherited
addVectorMathPackageDep bool
Adds the 'vector_math' package as a dependency to the package-under-test.
no setterinherited
analysisOptionsPath String
The file system path for analysis_options.yaml in testPackageRootPath.
no setterinherited
analysisRule String
The name of the analysis rule which this test is concerned with.
no setter
byteStore → ByteStore
The ByteStore reused between tests.
no setterinherited
contextCollection → AnalysisContextCollection
The AnalysisContextCollection managing the analysis contexts.
no setterinherited
dartSdkPath String
The file system path to the mock SDK root directory.
no setterinherited
dumpAstOnFailures bool
Whether to print out the syntax tree being tested, on a test failure.
no setterinherited
eol String
The line terminator being used for test files and to be expected in edits.
no setterinherited
experimentalFeatures List<Feature>
Return a list of the experimental features that are to be enabled for tests in this class.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
ignoredDiagnosticCodes List<DiagnosticCode>
Error codes that by default should be ignored in test expectations.
no setterinherited
packagesRootPath String
The path that is not in workspaceRootPath, contains external packages.
no setterinherited
pathContext → Context
The path context of resourceProvider.
no setterinherited
resourceProvider → ResourceProvider
latefinalinherited
result ↔ ResolvedUnitResult
The analysis result that is used in various assertDiagnostics methods.
getter/setter pairinherited
rule ↔ AbstractAnalysisRule
The AbstractAnalysisRule under test.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sdkRoot → Folder
The Folder representing the stub SDK root directory.
no setterinherited
session Future<AnalysisSession>
The AnalysisSession for the test package's testFile, after applying any pending file changes.
no setterinherited
testFile ↔ File
The test file being analyzed.
getter/setter pairinherited
testFileName String
The name of the test file.
no setterinherited
testFilePath String
The file system path of testFile.
no setterinherited
testPackageLanguageVersion String?
The language version for the package-under-test.
no setterinherited
testPackageLibPath String
The file system path of the lib directory of the package-under-test.
no setterinherited
testPackagePubspecPath String
The file system path for pubspec.yaml in testPackageRootPath.
no setterinherited
testPackageRootPath String
The file system path of the root of the package-under-test.
no setterinherited
testPackageTestPath String
The file system path to the test directory of the package-under-test.
no setterinherited
testPubspecPath String
The file system path for pubspec.yaml in testPackageRootPath.
no setterinherited
workspaceRootPath String
The file system path of the root of the workspace.
no setterinherited

Methods

addFfi() → Folder
inherited
addFixnum() → Folder
inherited
addFlutter() → Folder
inherited
addFlutterLocalizations() → Folder
inherited
addMeta() → Folder
inherited
addSkyEngine({required String sdkPath}) → Folder
Adds a mock sky_engine package with an _embedder.yaml file, and returns the Folder of the sky_engine package's 'lib' directory.
inherited
addTestReflectiveLoader() → Folder
inherited
addVectorMath() → Folder
inherited
assertDiagnostics(String content, List<ExpectedDiagnostic> expectedDiagnostics) Future<void>
Asserts that the number of diagnostics reported in content matches the number of expectedDiagnostics and that they have the expected error descriptions and locations.
inherited
assertDiagnosticsIn(List<Diagnostic> diagnostics, List<ExpectedDiagnostic> expectedDiagnostics) → void
Asserts that the diagnostics in diagnostics match expectedDiagnostics.
inherited
assertDiagnosticsInFile(String path, List<ExpectedDiagnostic> expectedDiagnostics) Future<void>
Asserts that the number of diagnostics that have been gathered at path matches the number of expectedDiagnostics and that they have the expected error descriptions and locations.
inherited
assertDiagnosticsInUnits(List<(String, List<ExpectedDiagnostic>)> unitsAndDiagnostics) Future<void>
Asserts that the diagnostics for each path match those in the paired expectedDiagnostics.
inherited
assertNoDiagnostics(String content) Future<void>
Asserts that there are no diagnostics in the given content.
inherited
assertNoDiagnosticsInFile(String path) Future<void>
Asserts that there are no diagnostics in the file at the given path.
inherited
assertNoPubspecDiagnostics(String content) Future<void>
Asserts that no diagnostics are reported when resolving content.
assertPubspecDiagnostics(String content, List<ExpectedDiagnostic> expectedDiagnostics) Future<void>
Asserts that expectedDiagnostics are reported when resolving content.
contextFor(String path) → DriverBasedAnalysisContext
Returns the existing analysis context that should be used to analyze the given path, or throw StateError if the path is not analyzed in any of the created analysis contexts.
inherited
contextFor2(File file) → DriverBasedAnalysisContext
Returns the existing analysis context that should be used to analyze the given file, or throw StateError if the file is not analyzed in any of the created analysis contexts.
inherited
convertPath(String filePath) String
Converts the given posix filePath to conform to resourceProvider's path context.
inherited
correctionMessage(List<Diagnostic> diagnostics) String
Text to display upon failure, which indicates possible corrections.
createAnalysisOptionsFile({List<String> includes = const [], List<Feature>? experimentalFeatures, List<String> legacyPlugins = const [], List<String> cannotIgnore = const [], List<String> lints = const [], Map<String, Object?> errors = const {}, bool propagateLinterExceptions = true, bool strictCasts = false, bool strictInference = false, bool strictRawTypes = false}) → void
Create an analysis options file based on the given arguments.
inherited
deleteFile(String path) → void
Deletes the file at path.
inherited
deleteFolder(String path) → void
Deletes the folder at path.
inherited
fromUri(Uri uri) String
Returns uri as a String.
inherited
getFile(String path) → File
Gets the File at path.
inherited
getFolder(String path) → Folder
Gets the Folder at path.
inherited
getResolvedUnit(File file) Future<ResolvedUnitResult>
Resolves and returns the ResolvedUnitResult for the given file.
inherited
join(String part1, [String? part2, String? part3, String? part4, String? part5, String? part6, String? part7, String? part8]) String
Joins the part paths as per path.Context.join.
inherited
lint(int offset, int length, {Pattern? correctionContains, Pattern? messageContains, List<Pattern> messageContainsAll = const [], String? name, List<ExpectedContextMessage>? contextMessages}) → ExpectedDiagnostic
Returns an "expected diagnostic" for rule (or name, if given) at offset and length.
missingExpectedMessage(List<ExpectedDiagnostic> unmatchedExpected) String
Text to display upon failure, indicating that unmatchedExpected diagnostics were expected, but not found.
inherited
modifyFile2(File file, String content) → void
Writes content to file.
inherited
newAnalysisOptionsYamlFile(String directoryPath, String content) → File
Writes a new analysis_options.yaml file at directoryPath with content.
inherited
newBazelBuildFile(String directoryPath, String content) → File
Creates a new Bazel BUILD file at directoryPath with content.
inherited
newBuildGnFile(String directoryPath, String content) → File
Creates a new BUILD.gn file at directoryPath with content.
inherited
newFile(String path, String content) → File
Creates or updates a file at path with the given content.
inherited
newFolder(String path) → Folder
Creates and returns a new Folder at path.
inherited
Creates and returns a new Link at path to target.
inherited
newPackage(String name) PackageBuilder
Registers a package named name.
inherited
newPackageConfigJsonFile(String directoryPath, String content) → File
Writes a .dart_tool/package_config.json file at directoryPath with content.
inherited
newPackageConfigJsonFileFromBuilder(String directoryPath, PackageConfigFileBuilder builder) → File
Writes a .dart_tool/package_config.json file at directoryPath, returning the File object.
inherited
newPubspecYamlFile(String directoryPath, String content) → File
Writes a pubspec.yaml file at directoryPath with content.
inherited
newSinglePackageConfigJsonFile({required String packagePath, required String name}) → void
Writes a new .dart_tool/package_config.json file for a package rooted at packagePath, named name.
inherited
normalize(String path) String
Joins the part paths as per path.Context.normalize.
inherited
normalizeSource(String code) String
Normalizes newlines in code for the current platform.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveFile(String filePath) Future<ResolvedUnitResult>
Resolves a Dart source file at filePath.
inherited
setUp() → void
Initializes the test environment before each test.
tearDown() Future<void>
Disposes of the test environment after each test.
inherited
toString() String
A string representation of this object.
inherited
toUri(String path) Uri
Converts path to a URI.
inherited
toUriStr(String path) String
Converts path to a URI and returns the normalized String representation of the URI.
inherited
unexpectedMessage(List<Diagnostic> unmatchedActual) String
Text to display upon failure, indicating that unmatchedActual diagnostics were found, but unexpected.
updateTestPubspecFile(String content) → void
Updates pubspec.yaml and creates the driver.
inherited
writeAnalysisOptionsFile(String content) → void
Writes string content as an analysis options file.
inherited
writePackageConfig(String path, PackageConfigFileBuilder config) → void
inherited
writePackageConfig2(String projectFolderPath, {String? packageName, PackageConfigFileBuilder? config, String? languageVersion}) → void
Writes a package_config.json for the package at projectFolderPath. If packageName is not supplied, the last segment of projectFolderPath is used.
inherited
writeTestPackageConfig(PackageConfigFileBuilder config) → void
Writes a package_config.json file from config, and for packages that have been added via newPackage.
inherited
writeTestPackageConfig2({PackageConfigFileBuilder? config, String? languageVersion}) → void
Writes a package_config.json file from config, and for packages that have been added via newPackage.
inherited

Operators

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