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.analysis.notification.highlights; | 5 library test.analysis.notification.highlights; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 | 12 |
13 import '../analysis_abstract.dart'; | 13 import '../analysis_abstract.dart'; |
14 import '../reflective_tests.dart'; | 14 import '../reflective_tests.dart'; |
15 | 15 |
16 | 16 |
17 main() { | 17 main() { |
18 runReflectiveTests(AnalysisNotificationHighlightsTest); | 18 runReflectiveTests(AnalysisNotificationHighlightsTest); |
19 runReflectiveTests(HighlightTypeTest); | 19 runReflectiveTests(HighlightTypeTest); |
20 } | 20 } |
21 | 21 |
22 | 22 |
23 @ReflectiveTestCase() | 23 @reflectiveTest |
24 class AnalysisNotificationHighlightsTest extends AbstractAnalysisTest { | 24 class AnalysisNotificationHighlightsTest extends AbstractAnalysisTest { |
25 List<HighlightRegion> regions; | 25 List<HighlightRegion> regions; |
26 | 26 |
27 void assertHasRawRegion(HighlightRegionType type, int offset, int length) { | 27 void assertHasRawRegion(HighlightRegionType type, int offset, int length) { |
28 for (HighlightRegion region in regions) { | 28 for (HighlightRegion region in regions) { |
29 if (region.offset == offset && | 29 if (region.offset == offset && |
30 region.length == length && | 30 region.length == length && |
31 region.type == type) { | 31 region.type == type) { |
32 return; | 32 return; |
33 } | 33 } |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 | 1010 |
1011 void _addLibraryForTestPart() { | 1011 void _addLibraryForTestPart() { |
1012 addFile('$testFolder/my_lib.dart', ''' | 1012 addFile('$testFolder/my_lib.dart', ''' |
1013 library lib; | 1013 library lib; |
1014 part 'test.dart'; | 1014 part 'test.dart'; |
1015 '''); | 1015 '''); |
1016 } | 1016 } |
1017 } | 1017 } |
1018 | 1018 |
1019 | 1019 |
1020 @ReflectiveTestCase() | 1020 @reflectiveTest |
1021 class HighlightTypeTest { | 1021 class HighlightTypeTest { |
1022 void test_constructor() { | 1022 void test_constructor() { |
1023 expect( | 1023 expect( |
1024 HighlightRegionType.CLASS, | 1024 HighlightRegionType.CLASS, |
1025 new HighlightRegionType(HighlightRegionType.CLASS.name)); | 1025 new HighlightRegionType(HighlightRegionType.CLASS.name)); |
1026 } | 1026 } |
1027 | 1027 |
1028 void test_toString() { | 1028 void test_toString() { |
1029 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); | 1029 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); |
1030 } | 1030 } |
1031 | 1031 |
1032 void test_valueOf_unknown() { | 1032 void test_valueOf_unknown() { |
1033 expect(() { | 1033 expect(() { |
1034 new HighlightRegionType('no-such-type'); | 1034 new HighlightRegionType('no-such-type'); |
1035 }, throws); | 1035 }, throws); |
1036 } | 1036 } |
1037 } | 1037 } |
OLD | NEW |