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

Side by Side Diff: pkg/analysis_services/test/correction/fix_test.dart

Issue 473563003: Sort separate Edits in FileEdit during adding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
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_services/correction/change.dart'; 7 import 'package:analysis_services/correction/change.dart';
8 import 'package:analysis_services/correction/fix.dart'; 8 import 'package:analysis_services/correction/fix.dart';
9 import 'package:analysis_services/index/index.dart'; 9 import 'package:analysis_services/index/index.dart';
10 import 'package:analysis_services/index/local_memory_index.dart'; 10 import 'package:analysis_services/index/local_memory_index.dart';
(...skipping 23 matching lines...) Expand all
34 Change change; 34 Change change;
35 String resultCode; 35 String resultCode;
36 36
37 void assertHasFix(FixKind kind, String expected) { 37 void assertHasFix(FixKind kind, String expected) {
38 AnalysisError error = _findErrorToFix(); 38 AnalysisError error = _findErrorToFix();
39 fix = _assertHasFix(kind, error); 39 fix = _assertHasFix(kind, error);
40 change = fix.change; 40 change = fix.change;
41 // apply to "file" 41 // apply to "file"
42 List<FileEdit> fileEdits = change.fileEdits; 42 List<FileEdit> fileEdits = change.fileEdits;
43 expect(fileEdits, hasLength(1)); 43 expect(fileEdits, hasLength(1));
44 // TODO(paulberry): should the code under test be responsible for sorting 44 resultCode = Edit.applySequence(testCode, change.fileEdits[0].edits);
45 // the edits?
46 resultCode = Edit.applySorted(testCode, change.fileEdits[0].edits);
47 // verify 45 // verify
48 expect(resultCode, expected); 46 expect(resultCode, expected);
49 } 47 }
50 48
51 void assertHasPositionGroup(String id, List<Position> expectedPositions) { 49 void assertHasPositionGroup(String id, List<Position> expectedPositions) {
52 List<LinkedEditGroup> linkedPositionGroups = change.linkedEditGroups; 50 List<LinkedEditGroup> linkedPositionGroups = change.linkedEditGroups;
53 for (LinkedEditGroup group in linkedPositionGroups) { 51 for (LinkedEditGroup group in linkedPositionGroups) {
54 if (group.id == id) { 52 if (group.id == id) {
55 expect(group.positions, unorderedEquals(expectedPositions)); 53 expect(group.positions, unorderedEquals(expectedPositions));
56 return; 54 return;
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 positions.add(new Position(testFile, offset)); 1871 positions.add(new Position(testFile, offset));
1874 } 1872 }
1875 return positions; 1873 return positions;
1876 } 1874 }
1877 1875
1878 void _indexTestUnit(String code) { 1876 void _indexTestUnit(String code) {
1879 resolveTestUnit(code); 1877 resolveTestUnit(code);
1880 index.indexUnit(context, testUnit); 1878 index.indexUnit(context, testUnit);
1881 } 1879 }
1882 } 1880 }
OLDNEW
« no previous file with comments | « pkg/analysis_services/test/correction/change_test.dart ('k') | pkg/analysis_services/test/refactoring/abstract_rename.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698