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

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1167733004: Decide if unit without directives is a part or a library. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
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.services.correction.fix; 5 library test.services.correction.fix;
6 6
7 import 'package:analysis_server/edit/fix/fix_core.dart'; 7 import 'package:analysis_server/edit/fix/fix_core.dart';
8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; 8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
9 import 'package:analysis_server/src/services/correction/fix.dart'; 9 import 'package:analysis_server/src/services/correction/fix.dart';
10 import 'package:analysis_server/src/services/correction/fix_internal.dart'; 10 import 'package:analysis_server/src/services/correction/fix_internal.dart';
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Comment first. 269 // Comment first.
270 // Comment second. 270 // Comment second.
271 271
272 class A {} 272 class A {}
273 '''; 273 ''';
274 addSource('/part.dart', partCode); 274 addSource('/part.dart', partCode);
275 resolveTestUnit(''' 275 resolveTestUnit('''
276 library my.lib; 276 library my.lib;
277 part 'part.dart'; 277 part 'part.dart';
278 '''); 278 ''');
279 _performAnalysis();
279 AnalysisError error = _findErrorToFix(); 280 AnalysisError error = _findErrorToFix();
280 fix = _assertHasFix(DartFixKind.ADD_PART_OF, error); 281 fix = _assertHasFix(DartFixKind.ADD_PART_OF, error);
281 change = fix.change; 282 change = fix.change;
282 // apply to "file" 283 // apply to "file"
283 List<SourceFileEdit> fileEdits = change.edits; 284 List<SourceFileEdit> fileEdits = change.edits;
284 expect(fileEdits, hasLength(1)); 285 expect(fileEdits, hasLength(1));
285 SourceFileEdit fileEdit = change.edits[0]; 286 SourceFileEdit fileEdit = change.edits[0];
286 expect(fileEdit.file, '/part.dart'); 287 expect(fileEdit.file, '/part.dart');
287 expect(SourceEdit.applySequence(partCode, fileEdit.edits), r''' 288 expect(SourceEdit.applySequence(partCode, fileEdit.edits), r'''
288 // Comment first. 289 // Comment first.
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 } 3909 }
3909 3910
3910 List<Position> _findResultPositions(List<String> searchStrings) { 3911 List<Position> _findResultPositions(List<String> searchStrings) {
3911 List<Position> positions = <Position>[]; 3912 List<Position> positions = <Position>[];
3912 for (String search in searchStrings) { 3913 for (String search in searchStrings) {
3913 int offset = resultCode.indexOf(search); 3914 int offset = resultCode.indexOf(search);
3914 positions.add(new Position(testFile, offset)); 3915 positions.add(new Position(testFile, offset));
3915 } 3916 }
3916 return positions; 3917 return positions;
3917 } 3918 }
3919
3920 void _performAnalysis() {
3921 while (context.performAnalysisTask().hasMoreWork);
3922 }
3918 } 3923 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | pkg/analyzer/lib/src/task/dart.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698