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

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

Issue 1380893003: More tests for 'Organize Directives'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « pkg/analysis_server/test/edit/organize_directives_test.dart ('k') | 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/organize_directives_test.dart
diff --git a/pkg/analysis_server/test/services/correction/organize_directives_test.dart b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
index 6c817b588bd05377cbb9023d4828de882a2ec660..833cc493408e84b7ec8e94e0ce26b097628fd1a9 100644
--- a/pkg/analysis_server/test/services/correction/organize_directives_test.dart
+++ b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
@@ -22,6 +22,29 @@ main() {
class OrganizeDirectivesTest extends AbstractSingleUnitTest {
List<AnalysisError> testErrors;
+ void test_keep_duplicateImports_withDifferentPrefix() {
+ _computeUnitAndErrors(r'''
+import 'dart:async' as async1;
+import 'dart:async' as async2;
+
+main() {
+ async1.Future f;
+ async2.Stream s;
+}''');
+ // validate change
+ _assertOrganize(
+ r'''
+import 'dart:async' as async1;
+import 'dart:async' as async2;
+
+main() {
+ async1.Future f;
+ async2.Stream s;
+}''',
+ removeUnresolved: true,
+ removeUnused: true);
+ }
+
void test_remove_duplicateImports() {
_computeUnitAndErrors(r'''
import 'dart:async';
@@ -42,6 +65,46 @@ main() {
removeUnused: true);
}
+ void test_remove_duplicateImports_differentText_uri() {
+ _computeUnitAndErrors(r'''
+import 'dart:async' as async;
+import "dart:async" as async;
+
+main() {
+ async.Future f;
+}''');
+ // validate change
+ _assertOrganize(
+ r'''
+import 'dart:async' as async;
+
+main() {
+ async.Future f;
+}''',
+ removeUnresolved: true,
+ removeUnused: true);
+ }
+
+ void test_remove_duplicateImports_withSamePrefix() {
+ _computeUnitAndErrors(r'''
+import 'dart:async' as async;
+import 'dart:async' as async;
+
+main() {
+ async.Future f;
+}''');
+ // validate change
+ _assertOrganize(
+ r'''
+import 'dart:async' as async;
+
+main() {
+ async.Future f;
+}''',
+ removeUnresolved: true,
+ removeUnused: true);
+ }
+
void test_remove_unresolvedDirectives() {
addSource('/existing_part1.dart', 'part of lib;');
addSource('/existing_part2.dart', 'part of lib;');
« no previous file with comments | « pkg/analysis_server/test/edit/organize_directives_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698