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

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

Issue 672013002: Issue 21375. Fix for FunctionTypeAliasElement-based FunctionType source. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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/pubspec.yaml ('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';
11 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; 11 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
12 import '../../reflective_tests.dart';
13 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
14 13
14 import '../../reflective_tests.dart';
15 import 'abstract_refactoring.dart'; 15 import 'abstract_refactoring.dart';
16 16
17 17
18 main() { 18 main() {
19 groupSep = ' | '; 19 groupSep = ' | ';
20 runReflectiveTests(ExtractMethodTest); 20 runReflectiveTests(ExtractMethodTest);
21 } 21 }
22 22
23 23
24 @ReflectiveTestCase() 24 @ReflectiveTestCase()
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 class A { 1316 class A {
1317 myMethod() { 1317 myMethod() {
1318 int v1 = 1; 1318 int v1 = 1;
1319 int v2 = 2; 1319 int v2 = 2;
1320 int positiveB = res(v1, v2); 1320 int positiveB = res(v1, v2);
1321 } 1321 }
1322 } 1322 }
1323 '''); 1323 ''');
1324 } 1324 }
1325 1325
1326 test_singleExpression_parameter_functionTypeAlias() {
1327 indexTestUnit('''
1328 typedef R Foo<S, R>(S s);
1329 void main(Foo<String, int> foo, String s) {
1330 int a = foo(s);
1331 }
1332 ''');
1333 _createRefactoringForString('foo(s)');
1334 // apply refactoring
1335 return _assertSuccessfulRefactoring('''
1336 typedef R Foo<S, R>(S s);
1337 void main(Foo<String, int> foo, String s) {
1338 int a = res(foo, s);
1339 }
1340
1341 int res(Foo<String, int> foo, String s) => foo(s);
1342 ''');
1343 }
1344
1326 test_singleExpression_returnTypeGeneric() { 1345 test_singleExpression_returnTypeGeneric() {
1327 indexTestUnit(''' 1346 indexTestUnit('''
1328 main() { 1347 main() {
1329 var v = new List<String>(); 1348 var v = new List<String>();
1330 } 1349 }
1331 '''); 1350 ''');
1332 _createRefactoringForString('new List<String>()'); 1351 _createRefactoringForString('new List<String>()');
1333 // apply refactoring 1352 // apply refactoring
1334 return _assertSuccessfulRefactoring(''' 1353 return _assertSuccessfulRefactoring('''
1335 main() { 1354 main() {
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 * Returns a deep copy of [refactoring] parameters. 2327 * Returns a deep copy of [refactoring] parameters.
2309 * There was a bug masked by updating parameter instances shared between the 2328 * There was a bug masked by updating parameter instances shared between the
2310 * refactoring and the test. 2329 * refactoring and the test.
2311 */ 2330 */
2312 List<RefactoringMethodParameter> _getParametersCopy() { 2331 List<RefactoringMethodParameter> _getParametersCopy() {
2313 return refactoring.parameters.map((p) { 2332 return refactoring.parameters.map((p) {
2314 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id); 2333 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id);
2315 }).toList(); 2334 }).toList();
2316 } 2335 }
2317 } 2336 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698