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

Side by Side Diff: pkg/analysis_server/test/services/correction/change_test.dart

Issue 849863002: Replace @ReflectiveTestCase() with @reflectiveTest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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.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:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 11
12 import '../../reflective_tests.dart'; 12 import '../../reflective_tests.dart';
13 13
14 14
15 main() { 15 main() {
16 groupSep = ' | '; 16 groupSep = ' | ';
17 runReflectiveTests(ChangeTest); 17 runReflectiveTests(ChangeTest);
18 runReflectiveTests(EditTest); 18 runReflectiveTests(EditTest);
19 runReflectiveTests(FileEditTest); 19 runReflectiveTests(FileEditTest);
20 runReflectiveTests(LinkedEditGroupTest); 20 runReflectiveTests(LinkedEditGroupTest);
21 runReflectiveTests(LinkedEditSuggestionTest); 21 runReflectiveTests(LinkedEditSuggestionTest);
22 runReflectiveTests(PositionTest); 22 runReflectiveTests(PositionTest);
23 } 23 }
24 24
25 25
26 @ReflectiveTestCase() 26 @reflectiveTest
27 class ChangeTest { 27 class ChangeTest {
28 void test_addEdit() { 28 void test_addEdit() {
29 SourceChange change = new SourceChange('msg'); 29 SourceChange change = new SourceChange('msg');
30 SourceEdit edit1 = new SourceEdit(1, 2, 'a'); 30 SourceEdit edit1 = new SourceEdit(1, 2, 'a');
31 SourceEdit edit2 = new SourceEdit(1, 2, 'b'); 31 SourceEdit edit2 = new SourceEdit(1, 2, 'b');
32 expect(change.edits, hasLength(0)); 32 expect(change.edits, hasLength(0));
33 change.addEdit('/a.dart', 0, edit1); 33 change.addEdit('/a.dart', 0, edit1);
34 expect(change.edits, hasLength(1)); 34 expect(change.edits, hasLength(1));
35 change.addEdit('/a.dart', 0, edit2); 35 change.addEdit('/a.dart', 0, edit2);
36 expect(change.edits, hasLength(1)); 36 expect(change.edits, hasLength(1));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 'offset': 42 134 'offset': 42
135 } 135 }
136 }; 136 };
137 expect(change.toJson(), expectedJson); 137 expect(change.toJson(), expectedJson);
138 // some toString() 138 // some toString()
139 change.toString(); 139 change.toString();
140 } 140 }
141 } 141 }
142 142
143 143
144 @ReflectiveTestCase() 144 @reflectiveTest
145 class EditTest { 145 class EditTest {
146 void test_applySequence() { 146 void test_applySequence() {
147 SourceEdit edit1 = new SourceEdit(5, 2, 'abc'); 147 SourceEdit edit1 = new SourceEdit(5, 2, 'abc');
148 SourceEdit edit2 = new SourceEdit(1, 0, '!'); 148 SourceEdit edit2 = new SourceEdit(1, 0, '!');
149 expect( 149 expect(
150 SourceEdit.applySequence('0123456789', [edit1, edit2]), 150 SourceEdit.applySequence('0123456789', [edit1, edit2]),
151 '0!1234abc789'); 151 '0!1234abc789');
152 } 152 }
153 153
154 void test_editFromRange() { 154 void test_editFromRange() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 OFFSET: 1, 186 OFFSET: 1,
187 LENGTH: 2, 187 LENGTH: 2,
188 REPLACEMENT: 'foo' 188 REPLACEMENT: 'foo'
189 }; 189 };
190 expect(edit.toJson(), expectedJson); 190 expect(edit.toJson(), expectedJson);
191 } 191 }
192 192
193 } 193 }
194 194
195 195
196 @ReflectiveTestCase() 196 @reflectiveTest
197 class FileEditTest { 197 class FileEditTest {
198 void test_add_sorts() { 198 void test_add_sorts() {
199 SourceEdit edit1a = new SourceEdit(1, 0, 'a1'); 199 SourceEdit edit1a = new SourceEdit(1, 0, 'a1');
200 SourceEdit edit1b = new SourceEdit(1, 0, 'a2'); 200 SourceEdit edit1b = new SourceEdit(1, 0, 'a2');
201 SourceEdit edit10 = new SourceEdit(10, 1, 'b'); 201 SourceEdit edit10 = new SourceEdit(10, 1, 'b');
202 SourceEdit edit100 = new SourceEdit(100, 2, 'c'); 202 SourceEdit edit100 = new SourceEdit(100, 2, 'c');
203 SourceFileEdit fileEdit = new SourceFileEdit('/test.dart', 0); 203 SourceFileEdit fileEdit = new SourceFileEdit('/test.dart', 0);
204 fileEdit.add(edit100); 204 fileEdit.add(edit100);
205 fileEdit.add(edit1a); 205 fileEdit.add(edit1a);
206 fileEdit.add(edit1b); 206 fileEdit.add(edit1b);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 OFFSET: 1, 244 OFFSET: 1,
245 LENGTH: 2, 245 LENGTH: 2,
246 REPLACEMENT: 'aaa' 246 REPLACEMENT: 'aaa'
247 },] 247 },]
248 }; 248 };
249 expect(fileEdit.toJson(), expectedJson); 249 expect(fileEdit.toJson(), expectedJson);
250 } 250 }
251 } 251 }
252 252
253 253
254 @ReflectiveTestCase() 254 @reflectiveTest
255 class LinkedEditGroupTest { 255 class LinkedEditGroupTest {
256 void test_new() { 256 void test_new() {
257 LinkedEditGroup group = new LinkedEditGroup.empty(); 257 LinkedEditGroup group = new LinkedEditGroup.empty();
258 group.addPosition(new Position('/a.dart', 1), 2); 258 group.addPosition(new Position('/a.dart', 1), 2);
259 group.addPosition(new Position('/b.dart', 10), 2); 259 group.addPosition(new Position('/b.dart', 10), 2);
260 expect( 260 expect(
261 group.toString(), 261 group.toString(),
262 '{"positions":[' '{"file":"/a.dart","offset":1},' 262 '{"positions":[' '{"file":"/a.dart","offset":1},'
263 '{"file":"/b.dart","offset":10}],"length":2,"suggestions":[]}'); 263 '{"file":"/b.dart","offset":10}],"length":2,"suggestions":[]}');
264 } 264 }
(...skipping 20 matching lines...) Expand all
285 'value': 'AA' 285 'value': 'AA'
286 }, { 286 }, {
287 'kind': 'TYPE', 287 'kind': 'TYPE',
288 'value': 'BB' 288 'value': 'BB'
289 }] 289 }]
290 }); 290 });
291 } 291 }
292 } 292 }
293 293
294 294
295 @ReflectiveTestCase() 295 @reflectiveTest
296 class LinkedEditSuggestionTest { 296 class LinkedEditSuggestionTest {
297 void test_eqEq() { 297 void test_eqEq() {
298 var a = new LinkedEditSuggestion('a', LinkedEditSuggestionKind.METHOD); 298 var a = new LinkedEditSuggestion('a', LinkedEditSuggestionKind.METHOD);
299 var a2 = new LinkedEditSuggestion('a', LinkedEditSuggestionKind.METHOD); 299 var a2 = new LinkedEditSuggestion('a', LinkedEditSuggestionKind.METHOD);
300 var b = new LinkedEditSuggestion('a', LinkedEditSuggestionKind.TYPE); 300 var b = new LinkedEditSuggestion('a', LinkedEditSuggestionKind.TYPE);
301 var c = new LinkedEditSuggestion('c', LinkedEditSuggestionKind.METHOD); 301 var c = new LinkedEditSuggestion('c', LinkedEditSuggestionKind.METHOD);
302 expect(a == a, isTrue); 302 expect(a == a, isTrue);
303 expect(a == a2, isTrue); 303 expect(a == a2, isTrue);
304 expect(a == this, isFalse); 304 expect(a == this, isFalse);
305 expect(a == b, isFalse); 305 expect(a == b, isFalse);
306 expect(a == c, isFalse); 306 expect(a == c, isFalse);
307 } 307 }
308 } 308 }
309 309
310 310
311 @ReflectiveTestCase() 311 @reflectiveTest
312 class PositionTest { 312 class PositionTest {
313 void test_eqEq() { 313 void test_eqEq() {
314 Position a = new Position('/a.dart', 1); 314 Position a = new Position('/a.dart', 1);
315 Position a2 = new Position('/a.dart', 1); 315 Position a2 = new Position('/a.dart', 1);
316 Position b = new Position('/b.dart', 1); 316 Position b = new Position('/b.dart', 1);
317 expect(a == a, isTrue); 317 expect(a == a, isTrue);
318 expect(a == a2, isTrue); 318 expect(a == a2, isTrue);
319 expect(a == b, isFalse); 319 expect(a == b, isFalse);
320 expect(a == this, isFalse); 320 expect(a == this, isFalse);
321 } 321 }
(...skipping 12 matching lines...) Expand all
334 334
335 void test_toJson() { 335 void test_toJson() {
336 Position position = new Position('/test.dart', 1); 336 Position position = new Position('/test.dart', 1);
337 var expectedJson = { 337 var expectedJson = {
338 FILE: '/test.dart', 338 FILE: '/test.dart',
339 OFFSET: 1 339 OFFSET: 1
340 }; 340 };
341 expect(position.toJson(), expectedJson); 341 expect(position.toJson(), expectedJson);
342 } 342 }
343 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698