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

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

Issue 2572013002: Fix for detecting lib/src. Sort fixes by relevance. (Closed)
Patch Set: Created 4 years 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 26f4178be67b522b284e4ee0e606cbd1a16c24da..aff6dd28a020aeee89b589ce96e2a7423eb2f3b7 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -45,6 +45,8 @@ class BaseFixProcessorTest extends AbstractSingleUnitTest {
error.errorCode != HintCode.UNUSED_LOCAL_VARIABLE;
};
+ String myPkgLibPath = '/packages/my_pkg/lib';
+
Fix fix;
SourceChange change;
String resultCode;
@@ -153,10 +155,10 @@ bool test() {
*/
void _configureMyPkg(Map<String, String> pathToCode) {
pathToCode.forEach((path, code) {
- provider.newFile('/packages/my_pkg/lib/$path', code);
+ provider.newFile('$myPkgLibPath/$path', code);
});
// configure SourceFactory
- Folder myPkgFolder = provider.getResource('/packages/my_pkg/lib');
+ Folder myPkgFolder = provider.getResource(myPkgLibPath);
UriResolver pkgResolver = new PackageMapUriResolver(provider, {
'my_pkg': [myPkgFolder]
});
@@ -3115,6 +3117,35 @@ main() {
''');
}
+ test_importLibraryPackage_preferDirectOverExport_src() async {
+ myPkgLibPath = '/my/src/packages/my_pkg/lib';
+ _configureMyPkg({'b.dart': 'class Test {}', 'a.dart': "export 'b.dart';"});
+ resolveTestUnit('''
+main() {
+ Test test = null;
+}
+''');
+ performAllAnalysisTasks();
+ await assertHasFix(
+ DartFixKind.IMPORT_LIBRARY_PROJECT1,
+ '''
+import 'package:my_pkg/b.dart';
+
+main() {
+ Test test = null;
+}
+''');
+ await assertHasFix(
+ DartFixKind.IMPORT_LIBRARY_PROJECT2,
+ '''
+import 'package:my_pkg/a.dart';
+
+main() {
+ Test test = null;
+}
+''');
+ }
+
test_importLibraryPackage_preferPublicOverPrivate() async {
_configureMyPkg(
{'src/a.dart': 'class Test {}', 'b.dart': "export 'src/a.dart';"});
« 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