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 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
11 import 'package:analysis_server/src/services/correction/status.dart'; | 11 import 'package:analysis_server/src/services/correction/status.dart'; |
12 import 'package:analysis_server/src/services/refactoring/extract_local.dart'; | 12 import 'package:analysis_server/src/services/refactoring/extract_local.dart'; |
13 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 13 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 14 import 'package:test/test.dart'; |
14 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 15 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
15 import 'package:unittest/unittest.dart'; | |
16 | 16 |
17 import '../../utils.dart'; | 17 import '../../utils.dart'; |
18 import 'abstract_refactoring.dart'; | 18 import 'abstract_refactoring.dart'; |
19 | 19 |
20 main() { | 20 main() { |
21 initializeTestEnvironment(); | 21 initializeTestEnvironment(); |
22 defineReflectiveTests(ExtractLocalTest); | 22 defineReflectiveSuite(() { |
| 23 defineReflectiveTests(ExtractLocalTest); |
| 24 }); |
23 } | 25 } |
24 | 26 |
25 @reflectiveTest | 27 @reflectiveTest |
26 class ExtractLocalTest extends RefactoringTest { | 28 class ExtractLocalTest extends RefactoringTest { |
27 ExtractLocalRefactoringImpl refactoring; | 29 ExtractLocalRefactoringImpl refactoring; |
28 | 30 |
29 test_checkFinalConditions_sameVariable_after() async { | 31 test_checkFinalConditions_sameVariable_after() async { |
30 indexTestUnit(''' | 32 indexTestUnit(''' |
31 main() { | 33 main() { |
32 int a = 1 + 2; | 34 int a = 1 + 2; |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 List<String> _getCoveringExpressions() { | 1341 List<String> _getCoveringExpressions() { |
1340 List<String> subExpressions = <String>[]; | 1342 List<String> subExpressions = <String>[]; |
1341 for (int i = 0; i < refactoring.coveringExpressionOffsets.length; i++) { | 1343 for (int i = 0; i < refactoring.coveringExpressionOffsets.length; i++) { |
1342 int offset = refactoring.coveringExpressionOffsets[i]; | 1344 int offset = refactoring.coveringExpressionOffsets[i]; |
1343 int length = refactoring.coveringExpressionLengths[i]; | 1345 int length = refactoring.coveringExpressionLengths[i]; |
1344 subExpressions.add(testCode.substring(offset, offset + length)); | 1346 subExpressions.add(testCode.substring(offset, offset + length)); |
1345 } | 1347 } |
1346 return subExpressions; | 1348 return subExpressions; |
1347 } | 1349 } |
1348 } | 1350 } |
OLD | NEW |