Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 2998903002: Add a test that requires adding an import (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 67c02889a63be86c35a15e47eaf29ce2eb334c44..422d5505ac051c8794d29dcde04508b2c43eb08d 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -2508,6 +2508,52 @@ main() {
_assertLinkedGroup(change.linkedEditGroups[0], ['test;', 'test.add(']);
}
+ test_createLocalVariable_withImport() async {
+ addPackageSource('analyzer', 'file_system/physical_file_system.dart', '''
scheglov 2017/08/12 22:28:32 I would prefer to use sanitized test with syntheti
Brian Wilkerson 2017/08/13 15:33:34 Done
+class PhysicalResourceProvider {
+ static final INSTANCE = null;
+}
+''');
+ addPackageSource('analyzer', 'src/generated/sdk.dart', '''
+class DartSdkManager {}
+''');
+ addPackageSource('analyzer', 'src/context/builder.dart', '''
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+
+class ContextBuilder {
+ ContextBuilder(PhysicalResourceProvider p, DartSdkManager m, i);
+}
+''');
+
+ await resolveTestUnit('''
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/context/builder.dart';
+
+main() {
+ String path = '/dart/issue30424/flutter/packages/flutter';
+
+ var resourceProvider = PhysicalResourceProvider.INSTANCE;
+
+ new ContextBuilder(resourceProvider, sdkManager, null);
+}
+''');
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, '''
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+
+main() {
+ String path = '/dart/issue30424/flutter/packages/flutter';
+
+ var resourceProvider = PhysicalResourceProvider.INSTANCE;
+
+ DartSdkManager sdkManager;
+ new ContextBuilder(resourceProvider, sdkManager, null);
+}
+''');
+ }
+
test_createLocalVariable_write_assignment() async {
await resolveTestUnit('''
main() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698