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 1144893002: Issue 23481. Fix for creating a new class referenced from an inner local function. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_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.fix; 5 library test.services.correction.fix;
6 6
7 import 'package:analysis_server/edit/fix/fix_core.dart'; 7 import 'package:analysis_server/edit/fix/fix_core.dart';
8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; 8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
9 import 'package:analysis_server/src/services/correction/fix.dart'; 9 import 'package:analysis_server/src/services/correction/fix.dart';
10 import 'package:analysis_server/src/services/correction/fix_internal.dart'; 10 import 'package:analysis_server/src/services/correction/fix_internal.dart';
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 main() { 382 main() {
383 Test v = null; 383 Test v = null;
384 } 384 }
385 385
386 class Test { 386 class Test {
387 } 387 }
388 '''); 388 ''');
389 _assertLinkedGroup(change.linkedEditGroups[0], ['Test v =', 'Test {']); 389 _assertLinkedGroup(change.linkedEditGroups[0], ['Test v =', 'Test {']);
390 } 390 }
391 391
392 void test_createClass_innerLocalFunction() {
393 resolveTestUnit('''
394 f() {
395 g() {
396 Test v = null;
397 }
398 }
399 ''');
400 assertHasFix(DartFixKind.CREATE_CLASS, '''
401 f() {
402 g() {
403 Test v = null;
404 }
405 }
406
407 class Test {
408 }
409 ''');
410 _assertLinkedGroup(change.linkedEditGroups[0], ['Test v =', 'Test {']);
411 }
412
392 void test_createConstructor_forFinalFields() { 413 void test_createConstructor_forFinalFields() {
393 errorFilter = (AnalysisError error) { 414 errorFilter = (AnalysisError error) {
394 return error.message.contains("'a'"); 415 return error.message.contains("'a'");
395 }; 416 };
396 resolveTestUnit(''' 417 resolveTestUnit('''
397 class Test { 418 class Test {
398 final int a; 419 final int a;
399 final int b = 2; 420 final int b = 2;
400 final int c; 421 final int c;
401 } 422 }
(...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3704 3725
3705 List<Position> _findResultPositions(List<String> searchStrings) { 3726 List<Position> _findResultPositions(List<String> searchStrings) {
3706 List<Position> positions = <Position>[]; 3727 List<Position> positions = <Position>[];
3707 for (String search in searchStrings) { 3728 for (String search in searchStrings) {
3708 int offset = resultCode.indexOf(search); 3729 int offset = resultCode.indexOf(search);
3709 positions.add(new Position(testFile, offset)); 3730 positions.add(new Position(testFile, offset));
3710 } 3731 }
3711 return positions; 3732 return positions;
3712 } 3733 }
3713 } 3734 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698