Skip to content

Move analyzer test utilities to analyzer_testing package #55660

@srawlins

Description

@srawlins

Quick background / example: I would like to move ResolveNameInScopeTest from the analyzer package to the linter package. But it depends on AbstractLinterContextTest (also in pkg/analyzer/test) which depends on PubPackageResolutionTest (also in pkg/analyzer/test). So I cannot move any tests until we have some shared base classes. Or I can copy swaths of code.

Creating shared testing code between the analyzer package, linter package, analysis_server and analysis_server_plugin packages is necessary for the plugins story. CC @bwilkerson @scheglov @pq

ContextResolutionTest

It would take significant investigation to determine how many test utility classes and mixins would be prudent to move. But as a starting place, I think it would be of huge benefit to move ContextResolutionTest into package:analyzer_utilities. How do we get there?

ResourceProviderMixin

ResourceProviderMixin (mixed into ContextResolutionTest) is declared in package:analyzer/src/test_utilities, so we're already in a good place there. Should be easier to move than other things, as it cannot depend on code in pkg/analyzer/test. This might be the best starting place.

ResolutionTest

ContextResolutionTest also mixes in ResolutionTest, so this is also a pre-requirement. Unfortunately it lives in pkg/analyzer/test, and is in a file which imports eight other files from pkg/analyzer/test. Yikes.

PubPackageResolutionTest

PubPackageResolutionTest is also an important base class, as it is the base for supporting analysis options files and package configs.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-code-healthInternal changes to our tools and workflows to make them cleaner, simpler, or more maintainable

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions