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

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

Issue 709493002: Fix 'Unused local variable' hints in analyzer and analysis_server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/protocol.dart' hide AnalysisError; 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 List<Fix> fixes = computeFixes(searchEngine, testUnit, error); 72 List<Fix> fixes = computeFixes(searchEngine, testUnit, error);
73 for (Fix fix in fixes) { 73 for (Fix fix in fixes) {
74 if (fix.kind == kind) { 74 if (fix.kind == kind) {
75 throw fail('Unexpected fix $kind in\n${fixes.join('\n')}'); 75 throw fail('Unexpected fix $kind in\n${fixes.join('\n')}');
76 } 76 }
77 } 77 }
78 } 78 }
79 79
80 Position expectedPosition(String search) { 80 Position expectedPosition(String search) {
81 int offset = resultCode.indexOf(search); 81 int offset = resultCode.indexOf(search);
82 int length = getLeadingIdentifierLength(search);
83 return new Position(testFile, offset); 82 return new Position(testFile, offset);
84 } 83 }
85 84
86 List<Position> expectedPositions(List<String> patterns) { 85 List<Position> expectedPositions(List<String> patterns) {
87 List<Position> positions = <Position>[]; 86 List<Position> positions = <Position>[];
88 patterns.forEach((String search) { 87 patterns.forEach((String search) {
89 positions.add(expectedPosition(search)); 88 positions.add(expectedPosition(search));
90 }); 89 });
91 return positions; 90 return positions;
92 } 91 }
(...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 if (checkHasSingleError) { 2309 if (checkHasSingleError) {
2311 expect(errors, hasLength(1)); 2310 expect(errors, hasLength(1));
2312 } 2311 }
2313 return errors[0]; 2312 return errors[0];
2314 } 2313 }
2315 2314
2316 List<Position> _findResultPositions(List<String> searchStrings) { 2315 List<Position> _findResultPositions(List<String> searchStrings) {
2317 List<Position> positions = <Position>[]; 2316 List<Position> positions = <Position>[];
2318 for (String search in searchStrings) { 2317 for (String search in searchStrings) {
2319 int offset = resultCode.indexOf(search); 2318 int offset = resultCode.indexOf(search);
2320 int length = getLeadingIdentifierLength(search);
2321 positions.add(new Position(testFile, offset)); 2319 positions.add(new Position(testFile, offset));
2322 } 2320 }
2323 return positions; 2321 return positions;
2324 } 2322 }
2325 2323
2326 void _indexTestUnit(String code) { 2324 void _indexTestUnit(String code) {
2327 resolveTestUnit(code); 2325 resolveTestUnit(code);
2328 index.indexUnit(context, testUnit); 2326 index.indexUnit(context, testUnit);
2329 } 2327 }
2330 } 2328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698