Migration: adapt instrumentation tests to test FixBuilder integration.
Change-Id: Ifaa471d881984c466bb07be17c48baf5be0175e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132170
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
diff --git a/pkg/nnbd_migration/test/instrumentation_test.dart b/pkg/nnbd_migration/test/instrumentation_test.dart
index dd80c7a..d7b36ac 100644
--- a/pkg/nnbd_migration/test/instrumentation_test.dart
+++ b/pkg/nnbd_migration/test/instrumentation_test.dart
@@ -18,11 +18,12 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(_InstrumentationTest);
+ defineReflectiveTests(_InstrumentationTestWithFixBuilder);
});
}
class _InstrumentationClient implements NullabilityMigrationInstrumentation {
- final _InstrumentationTest test;
+ final _InstrumentationTestBase test;
_InstrumentationClient(this.test);
@@ -97,7 +98,12 @@
}
@reflectiveTest
-class _InstrumentationTest extends AbstractContextTest {
+class _InstrumentationTest extends _InstrumentationTestBase {
+ @override
+ bool get useFixBuilder => false;
+}
+
+abstract class _InstrumentationTestBase extends AbstractContextTest {
NullabilityNodeInfo always;
final Map<TypeAnnotation, NullabilityNodeInfo> explicitTypeNullability = {};
@@ -127,12 +133,15 @@
Source source;
+ bool get useFixBuilder;
+
Future<void> analyze(String content) async {
var sourcePath = convertPath('/home/test/lib/test.dart');
newFile(sourcePath, content: content);
var listener = new TestMigrationListener();
var migration = NullabilityMigration(listener,
- instrumentation: _InstrumentationClient(this));
+ instrumentation: _InstrumentationClient(this),
+ useFixBuilder: useFixBuilder);
var result = await session.getResolvedUnit(sourcePath);
source = result.unit.declaredElement.source;
findNode = FindNode(content, result.unit);
@@ -1002,3 +1011,17 @@
(e) => e.sourceNode == node && e.destinationNode == never && e.isHard);
}
}
+
+@reflectiveTest
+class _InstrumentationTestWithFixBuilder extends _InstrumentationTestBase {
+ @override
+ bool get useFixBuilder => true;
+
+ @override
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/38472')
+ Future<void> test_fix_reason_edge() => super.test_fix_reason_edge();
+
+ @override
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/38472')
+ Future<void> test_fix_reason_node() => super.test_fix_reason_node();
+}