@@ -159,6 +159,8 @@ class NnbdMigrationTestBase extends AbstractAnalysisTest {
159159 var includedRoot = resourceProvider.pathContext.dirname (testFile);
160160 await _buildMigrationInfo ([testFile],
161161 includedRoot: includedRoot,
162+ shouldBeMigratedFunction: (String path) => true ,
163+ pathsToProcess: [testFile],
162164 removeViaComments: removeViaComments,
163165 warnOnWeakCode: warnOnWeakCode);
164166 }
@@ -190,13 +192,20 @@ class NnbdMigrationTestBase extends AbstractAnalysisTest {
190192 ///
191193 /// Returns the singular [UnitInfo] which was built.
192194 Future <List <UnitInfo >> buildInfoForTestFiles (Map <String , String > files,
193- {String includedRoot}) async {
195+ {@required String includedRoot,
196+ bool Function (String ) shouldBeMigratedFunction,
197+ Iterable <String > pathsToProcess}) async {
198+ shouldBeMigratedFunction ?? = (String path) => true ;
194199 var testPaths = < String > [];
195200 files.forEach ((String path, String content) {
196201 newFile (path, content: content);
197202 testPaths.add (path);
198203 });
199- await _buildMigrationInfo (testPaths, includedRoot: includedRoot);
204+ pathsToProcess ?? = testPaths;
205+ await _buildMigrationInfo (testPaths,
206+ includedRoot: includedRoot,
207+ shouldBeMigratedFunction: shouldBeMigratedFunction,
208+ pathsToProcess: pathsToProcess);
200209 // Ignore info for dart:core.
201210 var filteredInfos = [
202211 for (var info in infos)
@@ -212,8 +221,10 @@ class NnbdMigrationTestBase extends AbstractAnalysisTest {
212221
213222 /// Uses the InfoBuilder to build information for files at [testPaths] , which
214223 /// should all share a common parent directory, [includedRoot] .
215- Future <void > _buildMigrationInfo (List <String > testPaths,
216- {String includedRoot,
224+ Future <void > _buildMigrationInfo (Iterable <String > testPaths,
225+ {@required String includedRoot,
226+ @required bool Function (String ) shouldBeMigratedFunction,
227+ @required Iterable <String > pathsToProcess,
217228 bool removeViaComments = true ,
218229 bool warnOnWeakCode = false }) async {
219230 // Compute the analysis results.
@@ -243,8 +254,16 @@ class NnbdMigrationTestBase extends AbstractAnalysisTest {
243254 // Build the migration info.
244255 var info = instrumentationListener.data;
245256 var logger = TestLogger (false );
246- var builder = InfoBuilder (resourceProvider, includedRoot, info, listener,
247- migration, nodeMapper, logger, (String path) => true );
257+ var builder = InfoBuilder (
258+ resourceProvider,
259+ includedRoot,
260+ info,
261+ listener,
262+ migration,
263+ nodeMapper,
264+ logger,
265+ shouldBeMigratedFunction,
266+ pathsToProcess);
248267 infos = await builder.explainMigration ();
249268 }
250269}
0 commit comments