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

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

Issue 462403005: Move Location factories and RefactoringProblemSeverity.max into the generated classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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.status; 5 library test.services.correction.status;
6 6
7 import 'package:analysis_server/src/services/correction/status.dart'; 7 import 'package:analysis_server/src/services/correction/status.dart';
8 import 'package:analysis_server/src/services/search/search_engine.dart'; 8 import 'package:analysis_server/src/services/search/search_engine.dart';
9 import 'package:analysis_server/src/services/correction/source_range.dart'; 9 import 'package:analysis_server/src/services/correction/source_range.dart';
10 import 'package:analysis_testing/abstract_single_unit.dart'; 10 import 'package:analysis_testing/abstract_single_unit.dart';
(...skipping 12 matching lines...) Expand all
23 runReflectiveTests(RefactoringStatusTest); 23 runReflectiveTests(RefactoringStatusTest);
24 } 24 }
25 25
26 26
27 @ReflectiveTestCase() 27 @ReflectiveTestCase()
28 class RefactoringLocationTest extends AbstractSingleUnitTest { 28 class RefactoringLocationTest extends AbstractSingleUnitTest {
29 void test_createLocation_forElement() { 29 void test_createLocation_forElement() {
30 resolveTestUnit('class MyClass {}'); 30 resolveTestUnit('class MyClass {}');
31 Element element = findElement('MyClass'); 31 Element element = findElement('MyClass');
32 // check 32 // check
33 Location location = createLocation_forElement(element); 33 Location location = new Location.forElement(element);
34 expect(location.file, '/test.dart'); 34 expect(location.file, '/test.dart');
35 expect(location.offset, 6); 35 expect(location.offset, 6);
36 expect(location.length, 7); 36 expect(location.length, 7);
37 expect(location.startLine, 1); 37 expect(location.startLine, 1);
38 expect(location.startColumn, 7); 38 expect(location.startColumn, 7);
39 } 39 }
40 40
41 void test_createLocation_forMatch() { 41 void test_createLocation_forMatch() {
42 resolveTestUnit('class MyClass {}'); 42 resolveTestUnit('class MyClass {}');
43 Element element = findElement('MyClass'); 43 Element element = findElement('MyClass');
44 SourceRange range = rangeElementName(element); 44 SourceRange range = rangeElementName(element);
45 SearchMatch match = new SearchMatch(null, element, range, true, false); 45 SearchMatch match = new SearchMatch(null, element, range, true, false);
46 // check 46 // check
47 Location location = createLocation_forMatch(match); 47 Location location = new Location.forMatch(match);
48 expect(location.file, '/test.dart'); 48 expect(location.file, '/test.dart');
49 expect(location.offset, range.offset); 49 expect(location.offset, range.offset);
50 expect(location.length, range.length); 50 expect(location.length, range.length);
51 } 51 }
52 52
53 void test_createLocation_forNode() { 53 void test_createLocation_forNode() {
54 resolveTestUnit(''' 54 resolveTestUnit('''
55 main() { 55 main() {
56 } 56 }
57 '''); 57 ''');
58 AstNode node = findNodeAtString('main'); 58 AstNode node = findNodeAtString('main');
59 // check 59 // check
60 Location location = createLocation_forNode(node); 60 Location location = new Location.forNode(node);
61 expect(location.file, '/test.dart'); 61 expect(location.file, '/test.dart');
62 expect(location.offset, node.offset); 62 expect(location.offset, node.offset);
63 expect(location.length, node.length); 63 expect(location.length, node.length);
64 } 64 }
65 65
66 void test_createLocation_forUnit() { 66 void test_createLocation_forUnit() {
67 resolveTestUnit(''); 67 resolveTestUnit('');
68 SourceRange range = rangeStartLength(10, 20); 68 SourceRange range = rangeStartLength(10, 20);
69 // check 69 // check
70 Location location = createLocation_forUnit(testUnit, range); 70 Location location = new Location.forUnit(testUnit, range);
71 expect(location.file, '/test.dart'); 71 expect(location.file, '/test.dart');
72 expect(location.offset, range.offset); 72 expect(location.offset, range.offset);
73 expect(location.length, range.length); 73 expect(location.length, range.length);
74 } 74 }
75 } 75 }
76 76
77 77
78 @ReflectiveTestCase() 78 @ReflectiveTestCase()
79 class RefactoringStatusTest { 79 class RefactoringStatusTest {
80 void test_addError() { 80 void test_addError() {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL); 220 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL);
221 expect(refactoringStatus.message, 'msg'); 221 expect(refactoringStatus.message, 'msg');
222 } 222 }
223 223
224 void test_newWarning() { 224 void test_newWarning() {
225 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg'); 225 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg');
226 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING); 226 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING);
227 expect(refactoringStatus.message, 'msg'); 227 expect(refactoringStatus.message, 'msg');
228 } 228 }
229 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698