| OLD | NEW |
| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return _assertSuccessfulRefactoring(''' | 281 return _assertSuccessfulRefactoring(''' |
| 282 main() { | 282 main() { |
| 283 const res = 1; | 283 const res = 1; |
| 284 const [res + 2, 3]; | 284 const [res + 2, 3]; |
| 285 } | 285 } |
| 286 '''); | 286 '''); |
| 287 } | 287 } |
| 288 | 288 |
| 289 test_const_inList_inConditionalExpression() { | 289 test_const_inList_inConditionalExpression() { |
| 290 indexTestUnit(''' | 290 indexTestUnit(''' |
| 291 main(bool b) { | 291 main() { |
| 292 const [b ? 1 : 2, 3]; | 292 const [true ? 1 : 2, 3]; |
| 293 } | 293 } |
| 294 '''); | 294 '''); |
| 295 _createRefactoringForString('1'); | 295 _createRefactoringForString('1'); |
| 296 // apply refactoring | 296 // apply refactoring |
| 297 return _assertSuccessfulRefactoring(''' | 297 return _assertSuccessfulRefactoring(''' |
| 298 main(bool b) { | 298 main() { |
| 299 const res = 1; | 299 const res = 1; |
| 300 const [b ? res : 2, 3]; | 300 const [true ? res : 2, 3]; |
| 301 } | 301 } |
| 302 '''); | 302 '''); |
| 303 } | 303 } |
| 304 | 304 |
| 305 test_const_inList_inParenthesis() { | 305 test_const_inList_inParenthesis() { |
| 306 indexTestUnit(''' | 306 indexTestUnit(''' |
| 307 main() { | 307 main() { |
| 308 const [(1), 2]; | 308 const [(1), 2]; |
| 309 } | 309 } |
| 310 '''); | 310 '''); |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 int length = search.length; | 947 int length = search.length; |
| 948 _createRefactoring(offset, length); | 948 _createRefactoring(offset, length); |
| 949 } | 949 } |
| 950 | 950 |
| 951 void _createRefactoringWithSuffix(String selectionSearch, String suffix) { | 951 void _createRefactoringWithSuffix(String selectionSearch, String suffix) { |
| 952 int offset = findOffset(selectionSearch + suffix); | 952 int offset = findOffset(selectionSearch + suffix); |
| 953 int length = selectionSearch.length; | 953 int length = selectionSearch.length; |
| 954 _createRefactoring(offset, length); | 954 _createRefactoring(offset, length); |
| 955 } | 955 } |
| 956 } | 956 } |
| OLD | NEW |