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

Unified Diff: pkg/analysis_server/test/src/computer/import_elements_computer_test.dart

Issue 3002643002: Fix insertion of imports when there are no existing directives (issue 30430) (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
Index: pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
diff --git a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
index 3dc4631115da56de53235751de09e309f12e2c9f..63d54320ca920119ae47575ed16ad8be6041fc42 100644
--- a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
@@ -58,6 +58,24 @@ class ImportElementsComputerTest extends AbstractContextTest {
path = provider.convertPath('/test.dart');
}
+ test_createEdits_addImport_noDirectives() async {
scheglov 2017/08/14 18:37:51 Maybe also worth to add a test with parts.
Brian Wilkerson 2017/08/14 19:59:20 Absolutely. In fact, I think you found a bug. But
+ await createBuilder('''
+main() {
+ // paste here
+}
+''');
+ await computeChanges(<ImportedElements>[
+ new ImportedElements('/lib/math/math.dart', '', <String>['Random'])
+ ]);
+ assertChanges('''
+import 'dart:math';
+
+main() {
+ // paste here
+}
+''');
+ }
+
test_createEdits_addImport_noPrefix() async {
Source fooSource = addPackageSource('pkg', 'foo.dart', '');
await createBuilder('''

Powered by Google App Engine
This is Rietveld 408576698