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.source_range; | 5 library test.services.correction.source_range; |
6 | 6 |
7 import 'package:analysis_server/src/services/correction/source_range.dart'; | 7 import 'package:analysis_server/src/services/correction/source_range.dart'; |
8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
11 import 'package:analyzer/src/generated/parser.dart'; | 11 import 'package:analyzer/src/generated/parser.dart'; |
12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 13 import 'package:test/test.dart'; |
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 14 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
14 import 'package:unittest/unittest.dart'; | |
15 | 15 |
16 import '../../abstract_single_unit.dart'; | 16 import '../../abstract_single_unit.dart'; |
17 import '../../utils.dart'; | 17 import '../../utils.dart'; |
18 | 18 |
19 main() { | 19 main() { |
20 initializeTestEnvironment(); | 20 initializeTestEnvironment(); |
21 defineReflectiveTests(SourceRangesTest); | 21 defineReflectiveSuite(() { |
| 22 defineReflectiveTests(SourceRangesTest); |
| 23 }); |
22 } | 24 } |
23 | 25 |
24 @reflectiveTest | 26 @reflectiveTest |
25 class SourceRangesTest extends AbstractSingleUnitTest { | 27 class SourceRangesTest extends AbstractSingleUnitTest { |
26 void test_rangeElementName() { | 28 void test_rangeElementName() { |
27 resolveTestUnit('class ABC {}'); | 29 resolveTestUnit('class ABC {}'); |
28 Element element = findElement('ABC'); | 30 Element element = findElement('ABC'); |
29 expect(rangeElementName(element), new SourceRange(6, 3)); | 31 expect(rangeElementName(element), new SourceRange(6, 3)); |
30 } | 32 } |
31 | 33 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 expect(rangeStartStart(mainName, mainBody), new SourceRange(0, 7)); | 108 expect(rangeStartStart(mainName, mainBody), new SourceRange(0, 7)); |
107 } | 109 } |
108 | 110 |
109 void test_rangeToken() { | 111 void test_rangeToken() { |
110 resolveTestUnit(' main() {}'); | 112 resolveTestUnit(' main() {}'); |
111 FunctionDeclaration mainFunction = testUnit.declarations[0]; | 113 FunctionDeclaration mainFunction = testUnit.declarations[0]; |
112 SimpleIdentifier mainName = mainFunction.name; | 114 SimpleIdentifier mainName = mainFunction.name; |
113 expect(rangeToken(mainName.beginToken), new SourceRange(1, 4)); | 115 expect(rangeToken(mainName.beginToken), new SourceRange(1, 4)); |
114 } | 116 } |
115 } | 117 } |
OLD | NEW |