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.correction.change; | 5 library test.services.correction.change; |
6 | 6 |
7 import 'package:analysis_server/src/constants.dart'; | 7 import 'package:analysis_server/src/constants.dart'; |
8 import 'package:analysis_server/src/protocol_server.dart'; | 8 import 'package:analysis_server/src/protocol_server.dart'; |
9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:test/test.dart'; |
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
11 import 'package:unittest/unittest.dart'; | |
12 | 12 |
13 import '../../utils.dart'; | 13 import '../../utils.dart'; |
14 | 14 |
15 main() { | 15 main() { |
16 initializeTestEnvironment(); | 16 initializeTestEnvironment(); |
17 defineReflectiveTests(ChangeTest); | 17 defineReflectiveSuite(() { |
18 defineReflectiveTests(EditTest); | 18 defineReflectiveTests(ChangeTest); |
19 defineReflectiveTests(FileEditTest); | 19 defineReflectiveTests(EditTest); |
20 defineReflectiveTests(LinkedEditGroupTest); | 20 defineReflectiveTests(FileEditTest); |
21 defineReflectiveTests(LinkedEditSuggestionTest); | 21 defineReflectiveTests(LinkedEditGroupTest); |
22 defineReflectiveTests(PositionTest); | 22 defineReflectiveTests(LinkedEditSuggestionTest); |
| 23 defineReflectiveTests(PositionTest); |
| 24 }); |
23 } | 25 } |
24 | 26 |
25 @reflectiveTest | 27 @reflectiveTest |
26 class ChangeTest { | 28 class ChangeTest { |
27 void test_addEdit() { | 29 void test_addEdit() { |
28 SourceChange change = new SourceChange('msg'); | 30 SourceChange change = new SourceChange('msg'); |
29 SourceEdit edit1 = new SourceEdit(1, 2, 'a'); | 31 SourceEdit edit1 = new SourceEdit(1, 2, 'a'); |
30 SourceEdit edit2 = new SourceEdit(1, 2, 'b'); | 32 SourceEdit edit2 = new SourceEdit(1, 2, 'b'); |
31 expect(change.edits, hasLength(0)); | 33 expect(change.edits, hasLength(0)); |
32 change.addEdit('/a.dart', 0, edit1); | 34 change.addEdit('/a.dart', 0, edit1); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 expect(position.offset, 1); | 292 expect(position.offset, 1); |
291 expect(position.toString(), '{"file":"/test.dart","offset":1}'); | 293 expect(position.toString(), '{"file":"/test.dart","offset":1}'); |
292 } | 294 } |
293 | 295 |
294 void test_toJson() { | 296 void test_toJson() { |
295 Position position = new Position('/test.dart', 1); | 297 Position position = new Position('/test.dart', 1); |
296 var expectedJson = {FILE: '/test.dart', OFFSET: 1}; | 298 var expectedJson = {FILE: '/test.dart', OFFSET: 1}; |
297 expect(position.toJson(), expectedJson); | 299 expect(position.toJson(), expectedJson); |
298 } | 300 } |
299 } | 301 } |
OLD | NEW |