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

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

Issue 1042033002: Issue 23018. Fix for inlining multiline strings with leading whitespaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
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.inline_local; 5 library test.services.refactoring.inline_local;
6 6
7 import 'package:analysis_server/src/protocol.dart' hide Element; 7 import 'package:analysis_server/src/protocol.dart' hide Element;
8 import 'package:analysis_server/src/services/correction/status.dart'; 8 import 'package:analysis_server/src/services/correction/status.dart';
9 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; 9 import 'package:analysis_server/src/services/refactoring/inline_local.dart';
10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 '''); 250 ''');
251 _createRefactoring('a ='); 251 _createRefactoring('a =');
252 // validate change 252 // validate change
253 return assertSuccessfulRefactoring(r''' 253 return assertSuccessfulRefactoring(r'''
254 main() { 254 main() {
255 String b = "aaa bbb"; 255 String b = "aaa bbb";
256 } 256 }
257 '''); 257 ''');
258 } 258 }
259 259
260 test_OK_intoStringInterpolation_string_multiLineIntoMulti_leadingSpaces() {
261 indexTestUnit(r"""
262 main() {
263 String a = '''\ \
264 a
265 a''';
266 String b = '''
267 $a
268 bbb''';
269 }
270 """);
271 _createRefactoring('a =');
272 // validate change
273 return assertSuccessfulRefactoring(r"""
274 main() {
275 String b = '''
276 a
277 a
278 bbb''';
279 }
280 """);
281 }
282
260 test_OK_intoStringInterpolation_string_multiLineIntoMulti_unixEOL() { 283 test_OK_intoStringInterpolation_string_multiLineIntoMulti_unixEOL() {
261 indexTestUnit(r""" 284 indexTestUnit(r"""
262 main() { 285 main() {
263 String a = ''' 286 String a = '''
264 a 287 a
265 a 288 a
266 a'''; 289 a''';
267 String b = ''' 290 String b = '''
268 $a 291 $a
269 bbb'''; 292 bbb''';
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL, 592 assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
570 expectedMessage: 'Local variable declaration or reference must be ' 593 expectedMessage: 'Local variable declaration or reference must be '
571 'selected to activate this refactoring.'); 594 'selected to activate this refactoring.');
572 } 595 }
573 596
574 void _createRefactoring(String search) { 597 void _createRefactoring(String search) {
575 int offset = findOffset(search); 598 int offset = findOffset(search);
576 refactoring = new InlineLocalRefactoring(searchEngine, testUnit, offset); 599 refactoring = new InlineLocalRefactoring(searchEngine, testUnit, offset);
577 } 600 }
578 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698