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

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

Issue 2614033003: Make subclasses of AbstractContextTest asynchronous. (Closed)
Patch Set: Created 3 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
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/protocol_server.dart' hide Element; 7 import 'package:analysis_server/src/protocol_server.dart' hide Element;
8 import 'package:analysis_server/src/services/correction/source_range.dart'; 8 import 'package:analysis_server/src/services/correction/source_range.dart';
9 import 'package:analysis_server/src/services/correction/status.dart'; 9 import 'package:analysis_server/src/services/correction/status.dart';
10 import 'package:analysis_server/src/services/search/search_engine.dart'; 10 import 'package:analysis_server/src/services/search/search_engine.dart';
11 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ; 11 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ;
12 import 'package:analyzer/dart/ast/ast.dart'; 12 import 'package:analyzer/dart/ast/ast.dart';
13 import 'package:analyzer/dart/element/element.dart'; 13 import 'package:analyzer/dart/element/element.dart';
14 import 'package:analyzer/src/generated/source.dart'; 14 import 'package:analyzer/src/generated/source.dart';
15 import 'package:test/test.dart'; 15 import 'package:test/test.dart';
16 import 'package:test_reflective_loader/test_reflective_loader.dart'; 16 import 'package:test_reflective_loader/test_reflective_loader.dart';
17 17
18 import '../../abstract_single_unit.dart'; 18 import '../../abstract_single_unit.dart';
19 19
20 main() { 20 main() {
21 defineReflectiveSuite(() { 21 defineReflectiveSuite(() {
22 defineReflectiveTests(RefactoringLocationTest); 22 defineReflectiveTests(RefactoringLocationTest);
23 defineReflectiveTests(RefactoringStatusTest); 23 defineReflectiveTests(RefactoringStatusTest);
24 }); 24 });
25 } 25 }
26 26
27 @reflectiveTest 27 @reflectiveTest
28 class RefactoringLocationTest extends AbstractSingleUnitTest { 28 class RefactoringLocationTest extends AbstractSingleUnitTest {
29 void test_createLocation_forElement() { 29 test_createLocation_forElement() async {
30 resolveTestUnit('class MyClass {}'); 30 await resolveTestUnit('class MyClass {}');
31 Element element = findElement('MyClass'); 31 Element element = findElement('MyClass');
32 // check 32 // check
33 Location location = newLocation_fromElement(element); 33 Location location = newLocation_fromElement(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 test_createLocation_forMatch() async {
42 resolveTestUnit('class MyClass {}'); 42 await 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 SearchMatchImpl( 45 SearchMatch match = new SearchMatchImpl(
46 context, 46 context,
47 element.library.source.uri.toString(), 47 element.library.source.uri.toString(),
48 element.source.uri.toString(), 48 element.source.uri.toString(),
49 null, 49 null,
50 range, 50 range,
51 true, 51 true,
52 false); 52 false);
53 // check 53 // check
54 Location location = newLocation_fromMatch(match); 54 Location location = newLocation_fromMatch(match);
55 expect(location.file, '/test.dart'); 55 expect(location.file, '/test.dart');
56 expect(location.offset, range.offset); 56 expect(location.offset, range.offset);
57 expect(location.length, range.length); 57 expect(location.length, range.length);
58 } 58 }
59 59
60 void test_createLocation_forNode() { 60 test_createLocation_forNode() async {
61 resolveTestUnit(''' 61 await resolveTestUnit('''
62 main() { 62 main() {
63 } 63 }
64 '''); 64 ''');
65 AstNode node = findNodeAtString('main'); 65 AstNode node = findNodeAtString('main');
66 // check 66 // check
67 Location location = newLocation_fromNode(node); 67 Location location = newLocation_fromNode(node);
68 expect(location.file, '/test.dart'); 68 expect(location.file, '/test.dart');
69 expect(location.offset, node.offset); 69 expect(location.offset, node.offset);
70 expect(location.length, node.length); 70 expect(location.length, node.length);
71 } 71 }
72 72
73 void test_createLocation_forUnit() { 73 test_createLocation_forUnit() async {
74 resolveTestUnit(''); 74 await resolveTestUnit('');
75 SourceRange range = rangeStartLength(10, 20); 75 SourceRange range = rangeStartLength(10, 20);
76 // check 76 // check
77 Location location = newLocation_fromUnit(testUnit, range); 77 Location location = newLocation_fromUnit(testUnit, range);
78 expect(location.file, '/test.dart'); 78 expect(location.file, '/test.dart');
79 expect(location.offset, range.offset); 79 expect(location.offset, range.offset);
80 expect(location.length, range.length); 80 expect(location.length, range.length);
81 } 81 }
82 } 82 }
83 83
84 @reflectiveTest 84 @reflectiveTest
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL); 226 expect(refactoringStatus.severity, RefactoringProblemSeverity.FATAL);
227 expect(refactoringStatus.message, 'msg'); 227 expect(refactoringStatus.message, 'msg');
228 } 228 }
229 229
230 void test_newWarning() { 230 void test_newWarning() {
231 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg'); 231 RefactoringStatus refactoringStatus = new RefactoringStatus.warning('msg');
232 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING); 232 expect(refactoringStatus.severity, RefactoringProblemSeverity.WARNING);
233 expect(refactoringStatus.message, 'msg'); 233 expect(refactoringStatus.message, 'msg');
234 } 234 }
235 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698