| 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.highlights2; |
| 6 |
| 7 import 'dart:async'; |
| 6 | 8 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 10 | 12 |
| 11 import '../integration_tests.dart'; | 13 import '../integration_tests.dart'; |
| 12 | 14 |
| 13 main() { | 15 main() { |
| 14 defineReflectiveTests(AnalysisHighlightsTest); | 16 defineReflectiveTests(AnalysisHighlightsTest); |
| 15 } | 17 } |
| 16 | 18 |
| 17 @reflectiveTest | 19 @reflectiveTest |
| 18 class AnalysisHighlightsTest extends AbstractAnalysisServerIntegrationTest { | 20 class AnalysisHighlightsTest extends AbstractAnalysisServerIntegrationTest { |
| 21 Future startServer() { |
| 22 return server.start(useAnalysisHighlight2: true); |
| 23 } |
| 24 |
| 19 test_highlights() { | 25 test_highlights() { |
| 20 String pathname = sourcePath('test.dart'); | 26 String pathname = sourcePath('test.dart'); |
| 21 String text = r''' | 27 String text = r''' |
| 22 import 'dart:async' as async; | 28 import 'dart:async' as async; |
| 23 | 29 |
| 24 /** | 30 /** |
| 25 * Doc comment | 31 * Doc comment |
| 26 */ | 32 */ |
| 27 class Class<TypeParameter> { | 33 class Class<TypeParameter> { |
| 28 Class() { | 34 Class() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 42 /* Block comment */ | 48 /* Block comment */ |
| 43 } | 49 } |
| 44 | 50 |
| 45 static staticMethod() { | 51 static staticMethod() { |
| 46 } | 52 } |
| 47 | 53 |
| 48 get getter { | 54 get getter { |
| 49 } | 55 } |
| 50 | 56 |
| 51 set setter(int parameter) { | 57 set setter(int parameter) { |
| 58 print(parameter); |
| 52 } | 59 } |
| 53 } | 60 } |
| 54 | 61 |
| 55 class Class2<TypeParameter> extends Class<TypeParameter> { | 62 class Class2<TypeParameter> extends Class<TypeParameter> { |
| 56 @override | 63 @override |
| 57 method() { | 64 method() { |
| 58 } | 65 } |
| 59 } | 66 } |
| 60 | 67 |
| 61 typedef functionType(); | 68 typedef functionType(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 'Map', | 118 'Map', |
| 112 'int' | 119 'int' |
| 113 ]); | 120 ]); |
| 114 check(HighlightRegionType.COMMENT_BLOCK, ['/* Block comment */']); | 121 check(HighlightRegionType.COMMENT_BLOCK, ['/* Block comment */']); |
| 115 check(HighlightRegionType.COMMENT_DOCUMENTATION, | 122 check(HighlightRegionType.COMMENT_DOCUMENTATION, |
| 116 ['/**\n * Doc comment\n */']); | 123 ['/**\n * Doc comment\n */']); |
| 117 check( | 124 check( |
| 118 HighlightRegionType.COMMENT_END_OF_LINE, ['// End of line comment']); | 125 HighlightRegionType.COMMENT_END_OF_LINE, ['// End of line comment']); |
| 119 check(HighlightRegionType.CONSTRUCTOR, ['constructor']); | 126 check(HighlightRegionType.CONSTRUCTOR, ['constructor']); |
| 120 check(HighlightRegionType.DIRECTIVE, ["import 'dart:async' as async;"]); | 127 check(HighlightRegionType.DIRECTIVE, ["import 'dart:async' as async;"]); |
| 121 check(HighlightRegionType.DYNAMIC_TYPE, ['dynamicType']); | 128 check(HighlightRegionType.DYNAMIC_PARAMETER_DECLARATION, ['dynamicType']); |
| 122 check(HighlightRegionType.FIELD, ['field']); | 129 check(HighlightRegionType.INSTANCE_FIELD_DECLARATION, ['field']); |
| 123 check(HighlightRegionType.FIELD_STATIC, ['staticField']); | 130 check(HighlightRegionType.INSTANCE_SETTER_REFERENCE, ['field']); |
| 124 check(HighlightRegionType.FUNCTION, ['print']); | 131 check(HighlightRegionType.STATIC_FIELD_DECLARATION, ['staticField']); |
| 125 check(HighlightRegionType.FUNCTION_DECLARATION, ['function']); | 132 check(HighlightRegionType.TOP_LEVEL_FUNCTION_REFERENCE, ['print']); |
| 133 check(HighlightRegionType.TOP_LEVEL_FUNCTION_DECLARATION, ['function']); |
| 126 check(HighlightRegionType.FUNCTION_TYPE_ALIAS, ['functionType']); | 134 check(HighlightRegionType.FUNCTION_TYPE_ALIAS, ['functionType']); |
| 127 check(HighlightRegionType.GETTER_DECLARATION, ['getter']); | 135 check(HighlightRegionType.INSTANCE_GETTER_DECLARATION, ['getter']); |
| 128 check(HighlightRegionType.IDENTIFIER_DEFAULT, ['unresolvedIdentifier']); | 136 check(HighlightRegionType.IDENTIFIER_DEFAULT, ['unresolvedIdentifier']); |
| 129 check(HighlightRegionType.IMPORT_PREFIX, ['async']); | 137 check(HighlightRegionType.IMPORT_PREFIX, ['async']); |
| 130 check(HighlightRegionType.KEYWORD, ['class', 'true', 'return']); | 138 check(HighlightRegionType.KEYWORD, ['class', 'true', 'return']); |
| 131 check(HighlightRegionType.LITERAL_BOOLEAN, ['true']); | 139 check(HighlightRegionType.LITERAL_BOOLEAN, ['true']); |
| 132 check(HighlightRegionType.LITERAL_DOUBLE, ['1.0']); | 140 check(HighlightRegionType.LITERAL_DOUBLE, ['1.0']); |
| 133 check(HighlightRegionType.LITERAL_INTEGER, ['2', '42']); | 141 check(HighlightRegionType.LITERAL_INTEGER, ['2', '42']); |
| 134 check(HighlightRegionType.LITERAL_LIST, ['[]']); | 142 check(HighlightRegionType.LITERAL_LIST, ['[]']); |
| 135 check(HighlightRegionType.LITERAL_MAP, [ | 143 check(HighlightRegionType.LITERAL_MAP, [ |
| 136 '{1.0: [].toList()}', | 144 '{1.0: [].toList()}', |
| 137 '{2: local}' | 145 '{2: local}' |
| 138 ]); | 146 ]); |
| 139 check(HighlightRegionType.LITERAL_STRING, ["'dart:async'", "'string'"]); | 147 check(HighlightRegionType.LITERAL_STRING, ["'dart:async'", "'string'"]); |
| 140 check(HighlightRegionType.LOCAL_VARIABLE, ['local']); | |
| 141 check(HighlightRegionType.LOCAL_VARIABLE_DECLARATION, ['local']); | 148 check(HighlightRegionType.LOCAL_VARIABLE_DECLARATION, ['local']); |
| 142 check(HighlightRegionType.METHOD, ['toList']); | 149 check(HighlightRegionType.LOCAL_VARIABLE_REFERENCE, ['local']); |
| 143 check(HighlightRegionType.METHOD_DECLARATION, ['method']); | 150 check(HighlightRegionType.INSTANCE_METHOD_REFERENCE, ['toList']); |
| 144 check(HighlightRegionType.METHOD_DECLARATION_STATIC, ['staticMethod']); | 151 check(HighlightRegionType.INSTANCE_METHOD_DECLARATION, ['method']); |
| 145 check(HighlightRegionType.METHOD_STATIC, ['wait']); | 152 check(HighlightRegionType.STATIC_METHOD_DECLARATION, ['staticMethod']); |
| 146 check(HighlightRegionType.PARAMETER, ['parameter']); | 153 check(HighlightRegionType.STATIC_METHOD_REFERENCE, ['wait']); |
| 147 check(HighlightRegionType.SETTER_DECLARATION, ['setter']); | 154 check(HighlightRegionType.PARAMETER_DECLARATION, ['parameter']); |
| 148 check(HighlightRegionType.TOP_LEVEL_VARIABLE, [ | 155 check(HighlightRegionType.PARAMETER_REFERENCE, ['parameter']); |
| 149 'override', | 156 check(HighlightRegionType.INSTANCE_SETTER_DECLARATION, ['setter']); |
| 150 'topLevelVariable' | 157 check(HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE, ['override']); |
| 151 ]); | 158 check(HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION, |
| 159 ['topLevelVariable']); |
| 152 check(HighlightRegionType.TYPE_NAME_DYNAMIC, ['dynamic']); | 160 check(HighlightRegionType.TYPE_NAME_DYNAMIC, ['dynamic']); |
| 153 check(HighlightRegionType.TYPE_PARAMETER, ['TypeParameter']); | 161 check(HighlightRegionType.TYPE_PARAMETER, ['TypeParameter']); |
| 154 expect(highlights, isEmpty); | 162 expect(highlights, isEmpty); |
| 155 }); | 163 }); |
| 156 } | 164 } |
| 157 } | 165 } |
| OLD | NEW |