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.integration.analysis.highlights; | 5 library test.integration.analysis.highlights; |
6 | 6 |
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 8 import 'package:test/test.dart'; |
8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
9 import 'package:unittest/unittest.dart'; | |
10 | 10 |
11 import '../../utils.dart'; | 11 import '../../utils.dart'; |
12 import '../integration_tests.dart'; | 12 import '../integration_tests.dart'; |
13 | 13 |
14 main() { | 14 main() { |
15 initializeTestEnvironment(); | 15 initializeTestEnvironment(); |
16 defineReflectiveTests(AnalysisHighlightsTest); | 16 defineReflectiveSuite(() { |
| 17 defineReflectiveTests(AnalysisHighlightsTest); |
| 18 }); |
17 } | 19 } |
18 | 20 |
19 @reflectiveTest | 21 @reflectiveTest |
20 class AnalysisHighlightsTest extends AbstractAnalysisServerIntegrationTest { | 22 class AnalysisHighlightsTest extends AbstractAnalysisServerIntegrationTest { |
21 test_highlights() { | 23 test_highlights() { |
22 String pathname = sourcePath('test.dart'); | 24 String pathname = sourcePath('test.dart'); |
23 String text = r''' | 25 String text = r''' |
24 import 'dart:async' as async; | 26 import 'dart:async' as async; |
25 | 27 |
26 /** | 28 /** |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 94 } |
93 }); | 95 }); |
94 return analysisFinished.then((_) { | 96 return analysisFinished.then((_) { |
95 // There should be 1 error due to the fact that unresolvedIdentifier is | 97 // There should be 1 error due to the fact that unresolvedIdentifier is |
96 // unresolved. | 98 // unresolved. |
97 expect(currentAnalysisErrors[pathname], hasLength(1)); | 99 expect(currentAnalysisErrors[pathname], hasLength(1)); |
98 void check(HighlightRegionType type, List<String> expected) { | 100 void check(HighlightRegionType type, List<String> expected) { |
99 expect(highlights[type], equals(expected.toSet())); | 101 expect(highlights[type], equals(expected.toSet())); |
100 highlights.remove(type); | 102 highlights.remove(type); |
101 } | 103 } |
| 104 |
102 check(HighlightRegionType.ANNOTATION, ['@override']); | 105 check(HighlightRegionType.ANNOTATION, ['@override']); |
103 check(HighlightRegionType.BUILT_IN, | 106 check(HighlightRegionType.BUILT_IN, |
104 ['as', 'get', 'import', 'set', 'static', 'typedef']); | 107 ['as', 'get', 'import', 'set', 'static', 'typedef']); |
105 check(HighlightRegionType.CLASS, | 108 check(HighlightRegionType.CLASS, |
106 ['Class', 'Class2', 'Future', 'Map', 'int']); | 109 ['Class', 'Class2', 'Future', 'Map', 'int']); |
107 check(HighlightRegionType.COMMENT_BLOCK, ['/* Block comment */']); | 110 check(HighlightRegionType.COMMENT_BLOCK, ['/* Block comment */']); |
108 check(HighlightRegionType.COMMENT_DOCUMENTATION, | 111 check(HighlightRegionType.COMMENT_DOCUMENTATION, |
109 ['/**\n * Doc comment\n */']); | 112 ['/**\n * Doc comment\n */']); |
110 check( | 113 check( |
111 HighlightRegionType.COMMENT_END_OF_LINE, ['// End of line comment']); | 114 HighlightRegionType.COMMENT_END_OF_LINE, ['// End of line comment']); |
(...skipping 25 matching lines...) Expand all Loading... |
137 check(HighlightRegionType.PARAMETER, ['parameter']); | 140 check(HighlightRegionType.PARAMETER, ['parameter']); |
138 check(HighlightRegionType.SETTER_DECLARATION, ['setter']); | 141 check(HighlightRegionType.SETTER_DECLARATION, ['setter']); |
139 check(HighlightRegionType.TOP_LEVEL_VARIABLE, | 142 check(HighlightRegionType.TOP_LEVEL_VARIABLE, |
140 ['override', 'topLevelVariable']); | 143 ['override', 'topLevelVariable']); |
141 check(HighlightRegionType.TYPE_NAME_DYNAMIC, ['dynamic']); | 144 check(HighlightRegionType.TYPE_NAME_DYNAMIC, ['dynamic']); |
142 check(HighlightRegionType.TYPE_PARAMETER, ['TypeParameter']); | 145 check(HighlightRegionType.TYPE_PARAMETER, ['TypeParameter']); |
143 expect(highlights, isEmpty); | 146 expect(highlights, isEmpty); |
144 }); | 147 }); |
145 } | 148 } |
146 } | 149 } |
OLD | NEW |