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

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

Issue 492563002: Make more use of generated classes in analysis server. (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_server/src/services/correction/change.dart'; 7 import 'package:analysis_server/src/services/correction/change.dart';
8 import 'package:analysis_server/src/services/correction/fix.dart'; 8 import 'package:analysis_server/src/services/correction/fix.dart';
9 import 'package:analysis_server/src/services/index/index.dart'; 9 import 'package:analysis_server/src/services/index/index.dart';
10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 10 import 'package:analysis_server/src/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 resultCode = Edit.applySequence(testCode, change.fileEdits[0].edits); 44 resultCode = applySequence(testCode, change.fileEdits[0].edits);
45 // verify 45 // verify
46 expect(resultCode, expected); 46 expect(resultCode, expected);
47 } 47 }
48 48
49 void assertHasPositionGroup(String id, List<Position> expectedPositions) { 49 void assertHasPositionGroup(String id, List<Position> expectedPositions) {
50 List<LinkedEditGroup> linkedPositionGroups = change.linkedEditGroups; 50 List<LinkedEditGroup> linkedPositionGroups = change.linkedEditGroups;
51 for (LinkedEditGroup group in linkedPositionGroups) { 51 for (LinkedEditGroup group in linkedPositionGroups) {
52 if (group.id == id) { 52 if (group.id == id) {
53 expect(group.positions, unorderedEquals(expectedPositions)); 53 expect(group.positions, unorderedEquals(expectedPositions));
54 return; 54 return;
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 positions.add(new Position(testFile, offset)); 1871 positions.add(new Position(testFile, offset));
1872 } 1872 }
1873 return positions; 1873 return positions;
1874 } 1874 }
1875 1875
1876 void _indexTestUnit(String code) { 1876 void _indexTestUnit(String code) {
1877 resolveTestUnit(code); 1877 resolveTestUnit(code);
1878 index.indexUnit(context, testUnit); 1878 index.indexUnit(context, testUnit);
1879 } 1879 }
1880 } 1880 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698