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

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

Issue 1336323003: Issue 24338. Don't propose creating a local class for prefixed identifiers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/lib/src/services/correction/fix_internal.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/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 5735dec83143043504d097f9bbee59e484117d8b..393c2f37b0d34688afd5fa82db7ea5014f94de0a 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -541,6 +541,15 @@ class Test {
_assertLinkedGroup(change.linkedEditGroups[0], ['Test v =', 'Test {']);
}
+ void test_createClass_BAD_hasUnresolvedPrefix() {
+ resolveTestUnit('''
+main() {
+ prefix.Test v = null;
+}
+''');
+ assertNoFix(DartFixKind.CREATE_CLASS);
+ }
+
void test_createClass_inLibraryOfPrefix() {
String libCode = r'''
library my.lib;
@@ -2612,44 +2621,6 @@ main() {
''');
}
- void test_importLibraryPrefix_withClass() {
- resolveTestUnit('''
-import 'dart:async' as pref;
-main() {
- pref.Stream s = null;
- Future f = null;
-}
-''');
- assertHasFix(
- DartFixKind.IMPORT_LIBRARY_PREFIX,
- '''
-import 'dart:async' as pref;
-main() {
- pref.Stream s = null;
- pref.Future f = null;
-}
-''');
- }
-
- void test_importLibraryPrefix_withTopLevelVariable() {
- resolveTestUnit('''
-import 'dart:math' as pref;
-main() {
- print(pref.E);
- print(PI);
-}
-''');
- assertHasFix(
- DartFixKind.IMPORT_LIBRARY_PREFIX,
- '''
-import 'dart:math' as pref;
-main() {
- print(pref.E);
- print(pref.PI);
-}
-''');
- }
-
void test_importLibraryProject_withClass_annotation() {
addSource(
'/lib.dart',
@@ -4364,6 +4335,44 @@ main() {
''');
}
+ void test_useImportPrefix_withClass() {
+ resolveTestUnit('''
+import 'dart:async' as pref;
+main() {
+ pref.Stream s = null;
+ Future f = null;
+}
+''');
+ assertHasFix(
+ DartFixKind.IMPORT_LIBRARY_PREFIX,
+ '''
+import 'dart:async' as pref;
+main() {
+ pref.Stream s = null;
+ pref.Future f = null;
+}
+''');
+ }
+
+ void test_useImportPrefix_withTopLevelVariable() {
+ resolveTestUnit('''
+import 'dart:math' as pref;
+main() {
+ print(pref.E);
+ print(PI);
+}
+''');
+ assertHasFix(
+ DartFixKind.IMPORT_LIBRARY_PREFIX,
+ '''
+import 'dart:math' as pref;
+main() {
+ print(pref.E);
+ print(pref.PI);
+}
+''');
+ }
+
/**
* Computes fixes and verifies that there is a fix of the given kind.
*/
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698