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_reflective_loader/test_reflective_loader.dart'; |
10 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
11 | 12 |
12 import '../../reflective_tests.dart'; | |
13 | |
14 main() { | 13 main() { |
15 groupSep = ' | '; | 14 groupSep = ' | '; |
16 runReflectiveTests(ChangeTest); | 15 defineReflectiveTests(ChangeTest); |
17 runReflectiveTests(EditTest); | 16 defineReflectiveTests(EditTest); |
18 runReflectiveTests(FileEditTest); | 17 defineReflectiveTests(FileEditTest); |
19 runReflectiveTests(LinkedEditGroupTest); | 18 defineReflectiveTests(LinkedEditGroupTest); |
20 runReflectiveTests(LinkedEditSuggestionTest); | 19 defineReflectiveTests(LinkedEditSuggestionTest); |
21 runReflectiveTests(PositionTest); | 20 defineReflectiveTests(PositionTest); |
22 } | 21 } |
23 | 22 |
24 @reflectiveTest | 23 @reflectiveTest |
25 class ChangeTest { | 24 class ChangeTest { |
26 void test_addEdit() { | 25 void test_addEdit() { |
27 SourceChange change = new SourceChange('msg'); | 26 SourceChange change = new SourceChange('msg'); |
28 SourceEdit edit1 = new SourceEdit(1, 2, 'a'); | 27 SourceEdit edit1 = new SourceEdit(1, 2, 'a'); |
29 SourceEdit edit2 = new SourceEdit(1, 2, 'b'); | 28 SourceEdit edit2 = new SourceEdit(1, 2, 'b'); |
30 expect(change.edits, hasLength(0)); | 29 expect(change.edits, hasLength(0)); |
31 change.addEdit('/a.dart', 0, edit1); | 30 change.addEdit('/a.dart', 0, edit1); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 expect(position.offset, 1); | 286 expect(position.offset, 1); |
288 expect(position.toString(), '{"file":"/test.dart","offset":1}'); | 287 expect(position.toString(), '{"file":"/test.dart","offset":1}'); |
289 } | 288 } |
290 | 289 |
291 void test_toJson() { | 290 void test_toJson() { |
292 Position position = new Position('/test.dart', 1); | 291 Position position = new Position('/test.dart', 1); |
293 var expectedJson = {FILE: '/test.dart', OFFSET: 1}; | 292 var expectedJson = {FILE: '/test.dart', OFFSET: 1}; |
294 expect(position.toJson(), expectedJson); | 293 expect(position.toJson(), expectedJson); |
295 } | 294 } |
296 } | 295 } |
OLD | NEW |