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

Side by Side Diff: pkg/analysis_server/test/edit/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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/organize_directives_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.edit.organize_directives; 5 library test.edit.organize_directives;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/edit/edit_domain.dart'; 9 import 'package:analysis_server/src/edit/edit_domain.dart';
10 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 Future test_BAD_notDartFile() async { 59 Future test_BAD_notDartFile() async {
60 await waitForTasksFinished(); 60 await waitForTasksFinished();
61 Request request = 61 Request request =
62 new EditOrganizeDirectivesParams('/not-a-Dart-file.txt').toRequest('0'); 62 new EditOrganizeDirectivesParams('/not-a-Dart-file.txt').toRequest('0');
63 Response response = handler.handleRequest(request); 63 Response response = handler.handleRequest(request);
64 expect( 64 expect(
65 response, isResponseFailure('0', RequestErrorCode.FILE_NOT_ANALYZED)); 65 response, isResponseFailure('0', RequestErrorCode.FILE_NOT_ANALYZED));
66 } 66 }
67 67
68 Future test_OK_remove_duplicateImports_withSamePrefix() {
69 addTestFile('''
70 library lib;
71
72 import 'dart:async' as async;
73 import 'dart:async' as async;
74
75 main() {
76 async.Future f;
77 }
78 ''');
79 return _assertOrganized(r'''
80 library lib;
81
82 import 'dart:async' as async;
83
84 main() {
85 async.Future f;
86 }
87 ''');
88 }
89
68 Future test_OK_remove_unresolvedDirectives() { 90 Future test_OK_remove_unresolvedDirectives() {
69 addFile('$testFolder/existing_part1.dart', 'part of lib;'); 91 addFile('$testFolder/existing_part1.dart', 'part of lib;');
70 addFile('$testFolder/existing_part2.dart', 'part of lib;'); 92 addFile('$testFolder/existing_part2.dart', 'part of lib;');
71 addTestFile(''' 93 addTestFile('''
72 library lib; 94 library lib;
73 95
74 export 'dart:noSuchExportSdkLibrary'; 96 export 'dart:noSuchExportSdkLibrary';
75 export 'dart:async'; 97 export 'dart:async';
76 export 'package:noSuchExportPackage/andLib.dart'; 98 export 'package:noSuchExportPackage/andLib.dart';
77 export 'dart:math'; 99 export 'dart:math';
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 expect(resultCode, expectedCode); 163 expect(resultCode, expectedCode);
142 } 164 }
143 165
144 void _requestOrganize() { 166 void _requestOrganize() {
145 Request request = new EditOrganizeDirectivesParams(testFile).toRequest('0'); 167 Request request = new EditOrganizeDirectivesParams(testFile).toRequest('0');
146 Response response = handleSuccessfulRequest(request); 168 Response response = handleSuccessfulRequest(request);
147 var result = new EditOrganizeDirectivesResult.fromResponse(response); 169 var result = new EditOrganizeDirectivesResult.fromResponse(response);
148 fileEdit = result.edit; 170 fileEdit = result.edit;
149 } 171 }
150 } 172 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/organize_directives_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698