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

Side by Side Diff: pkg/analysis_server/test/services/refactoring/extract_method_test.dart

Issue 832343004: Issue 21959. Check that type of parameters in 'Extract Method' occurrences are exactly the same. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_method.dart ('k') | no next file » | 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.services.refactoring.extract_method; 5 library test.services.refactoring.extract_method;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/refactoring/extract_method.dart'; 10 import 'package:analysis_server/src/services/refactoring/extract_method.dart';
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 int res(int v1, int v2) => v1 + v2; 1299 int res(int v1, int v2) => v1 + v2;
1300 } 1300 }
1301 main() { 1301 main() {
1302 int v1 = 1; 1302 int v1 = 1;
1303 int v2 = 2; 1303 int v2 = 2;
1304 int negA = v1 + v2; 1304 int negA = v1 + v2;
1305 } 1305 }
1306 '''); 1306 ''');
1307 } 1307 }
1308 1308
1309 test_singleExpression_occurrences_incompatibleTypes() {
1310 indexTestUnit('''
1311 main() {
1312 int x = 1;
1313 String y = 'foo';
1314 print(x.toString());
1315 print(y.toString());
1316 }
1317 ''');
1318 _createRefactoringForString('x.toString()');
1319 // apply refactoring
1320 return _assertSuccessfulRefactoring('''
1321 main() {
1322 int x = 1;
1323 String y = 'foo';
1324 print(res(x));
1325 print(y.toString());
1326 }
1327
1328 String res(int x) => x.toString();
1329 ''');
1330 }
1331
1309 test_singleExpression_occurrences_inWholeUnit() { 1332 test_singleExpression_occurrences_inWholeUnit() {
1310 indexTestUnit(''' 1333 indexTestUnit('''
1311 main() { 1334 main() {
1312 int v1 = 1; 1335 int v1 = 1;
1313 int v2 = 2; 1336 int v2 = 2;
1314 int positiveA = v1 + v2; // marker 1337 int positiveA = v1 + v2; // marker
1315 } 1338 }
1316 class A { 1339 class A {
1317 myMethod() { 1340 myMethod() {
1318 int v1 = 1; 1341 int v1 = 1;
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 * Returns a deep copy of [refactoring] parameters. 2488 * Returns a deep copy of [refactoring] parameters.
2466 * There was a bug masked by updating parameter instances shared between the 2489 * There was a bug masked by updating parameter instances shared between the
2467 * refactoring and the test. 2490 * refactoring and the test.
2468 */ 2491 */
2469 List<RefactoringMethodParameter> _getParametersCopy() { 2492 List<RefactoringMethodParameter> _getParametersCopy() {
2470 return refactoring.parameters.map((p) { 2493 return refactoring.parameters.map((p) {
2471 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id); 2494 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id);
2472 }).toList(); 2495 }).toList();
2473 } 2496 }
2474 } 2497 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_method.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698