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

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

Issue 664403002: Issue 21372. "Convert into block body" and "Convert into expression body" for factory constructors. (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/lib/src/services/correction/assist_internal.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.correction.assist; 5 library test.services.correction.assist;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analysis_server/src/services/correction/assist.dart'; 8 import 'package:analysis_server/src/services/correction/assist.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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 _indexTestUnit(''' 435 _indexTestUnit('''
436 fff() { 436 fff() {
437 return 42; 437 return 42;
438 } 438 }
439 '''); 439 ''');
440 assertHasAssistAt('ff()', AssistKind.CONVERT_INTO_EXPRESSION_BODY, ''' 440 assertHasAssistAt('ff()', AssistKind.CONVERT_INTO_EXPRESSION_BODY, '''
441 fff() => 42; 441 fff() => 42;
442 '''); 442 ''');
443 } 443 }
444 444
445 void test_convertToExpressionBody_OK_constructor() {
446 _indexTestUnit('''
447 class A {
448 factory A() {
449 return null;
450 }
451 }
452 ''');
453 assertHasAssistAt('A()', AssistKind.CONVERT_INTO_EXPRESSION_BODY, '''
454 class A {
455 factory A() => null;
456 }
457 ''');
458 }
459
460 void test_convertToBlockBody_OK_constructor() {
461 _indexTestUnit('''
462 class A {
463 factory A() => null;
464 }
465 ''');
466 assertHasAssistAt('A()', AssistKind.CONVERT_INTO_BLOCK_BODY, '''
467 class A {
468 factory A() {
469 return null;
470 }
471 }
472 ''');
473 }
474
445 void test_convertToExpressionBody_OK_method_onBlock() { 475 void test_convertToExpressionBody_OK_method_onBlock() {
446 _indexTestUnit(''' 476 _indexTestUnit('''
447 class A { 477 class A {
448 m() { // marker 478 m() { // marker
449 return 42; 479 return 42;
450 } 480 }
451 } 481 }
452 '''); 482 ''');
453 assertHasAssistAt( 483 assertHasAssistAt(
454 '{ // marker', 484 '{ // marker',
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 void _indexTestUnit(String code) { 2350 void _indexTestUnit(String code) {
2321 resolveTestUnit(code); 2351 resolveTestUnit(code);
2322 index.indexUnit(context, testUnit); 2352 index.indexUnit(context, testUnit);
2323 } 2353 }
2324 2354
2325 void _setStartEndSelection() { 2355 void _setStartEndSelection() {
2326 offset = findOffset('// start\n') + '// start\n'.length; 2356 offset = findOffset('// start\n') + '// start\n'.length;
2327 length = findOffset('// end') - offset; 2357 length = findOffset('// end') - offset;
2328 } 2358 }
2329 } 2359 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698