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

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

Issue 820763002: Fix for extracting from interpolated string. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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_local.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_local; 5 library test.services.refactoring.extract_local;
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_local.dart'; 10 import 'package:analysis_server/src/services/refactoring/extract_local.dart';
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 _createRefactoringForString("'abc'"); 904 _createRefactoringForString("'abc'");
905 // apply refactoring 905 // apply refactoring
906 return _assertSuccessfulRefactoring(''' 906 return _assertSuccessfulRefactoring('''
907 main() { 907 main() {
908 var res = 'abc'; 908 var res = 'abc';
909 print(res); 909 print(res);
910 } 910 }
911 '''); 911 ''');
912 } 912 }
913 913
914 test_stringLiteralPart() {
915 indexTestUnit(r'''
916 main() {
917 int x = 1;
918 int y = 2;
919 print('$x+$y=${x+y}');
920 }
921 ''');
922 _createRefactoringForString(r'$x+$y');
923 // apply refactoring
924 return _assertSuccessfulRefactoring(r'''
925 main() {
926 int x = 1;
927 int y = 2;
928 var res = '$x+$y';
929 print('${res}=${x+y}');
930 }
931 ''');
932 }
933
914 Future _assertInitialConditions_fatal_selection() { 934 Future _assertInitialConditions_fatal_selection() {
915 return refactoring.checkInitialConditions().then((status) { 935 return refactoring.checkInitialConditions().then((status) {
916 assertRefactoringStatus( 936 assertRefactoringStatus(
917 status, 937 status,
918 RefactoringProblemSeverity.FATAL, 938 RefactoringProblemSeverity.FATAL,
919 expectedMessage: 'Expression must be selected to activate this refacto ring.'); 939 expectedMessage: 'Expression must be selected to activate this refacto ring.');
920 }); 940 });
921 } 941 }
922 942
923 /** 943 /**
(...skipping 23 matching lines...) Expand all
947 int length = search.length; 967 int length = search.length;
948 _createRefactoring(offset, length); 968 _createRefactoring(offset, length);
949 } 969 }
950 970
951 void _createRefactoringWithSuffix(String selectionSearch, String suffix) { 971 void _createRefactoringWithSuffix(String selectionSearch, String suffix) {
952 int offset = findOffset(selectionSearch + suffix); 972 int offset = findOffset(selectionSearch + suffix);
953 int length = selectionSearch.length; 973 int length = selectionSearch.length;
954 _createRefactoring(offset, length); 974 _createRefactoring(offset, length);
955 } 975 }
956 } 976 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_local.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698