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

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

Issue 1253103007: WEB-17598. Name new libraries according to the Dart Style Guide. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « 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 f439ce02aa008d9c418d43933b9b1d1f2928a0c2..f0692c6544122462dda42180bc0804ea28e75e7f 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -1405,7 +1405,48 @@ import 'my_file.dart';
expect(fileEdit.file, '/my/project/bin/my_file.dart');
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
- expect(fileEdit.edits[0].replacement, contains('library my.file;'));
+ expect(fileEdit.edits[0].replacement, contains('library my_file;'));
+ }
+
+ void test_createFile_forImport_inPackage_lib() {
+ provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package');
+ testFile = '/projects/my_package/lib/test.dart';
+ provider.newFolder('/projects/my_package/lib');
+ resolveTestUnit('''
+import 'a/bb/c_cc/my_lib.dart';
+''');
+ AnalysisError error = _findErrorToFix();
+ fix = _assertHasFix(DartFixKind.CREATE_FILE, error);
+ change = fix.change;
+ // validate change
+ List<SourceFileEdit> fileEdits = change.edits;
+ expect(fileEdits, hasLength(1));
+ SourceFileEdit fileEdit = change.edits[0];
+ expect(fileEdit.file, '/projects/my_package/lib/a/bb/c_cc/my_lib.dart');
+ expect(fileEdit.fileStamp, -1);
+ expect(fileEdit.edits, hasLength(1));
+ expect(fileEdit.edits[0].replacement,
+ contains('library my_package.a.bb.c_cc.my_lib;'));
+ }
+
+ void test_createFile_forImport_inPackage_test() {
+ provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package');
+ testFile = '/projects/my_package/test/misc/test_all.dart';
+ resolveTestUnit('''
+import 'a/bb/my_lib.dart';
+''');
+ AnalysisError error = _findErrorToFix();
+ fix = _assertHasFix(DartFixKind.CREATE_FILE, error);
+ change = fix.change;
+ // validate change
+ List<SourceFileEdit> fileEdits = change.edits;
+ expect(fileEdits, hasLength(1));
+ SourceFileEdit fileEdit = change.edits[0];
+ expect(fileEdit.file, '/projects/my_package/test/misc/a/bb/my_lib.dart');
+ expect(fileEdit.fileStamp, -1);
+ expect(fileEdit.edits, hasLength(1));
+ expect(fileEdit.edits[0].replacement,
+ contains('library my_package.test.misc.a.bb.my_lib;'));
}
void test_createFile_forPart() {
@@ -4348,7 +4389,7 @@ main() {
* Computes fixes for the given [error] in [testUnit].
*/
List<Fix> _computeFixes(AnalysisError error) {
- FixProcessor processor = new FixProcessor(testUnit, error);
+ FixProcessor processor = new FixProcessor(provider, testUnit, error);
return processor.compute();
}
« 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