| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.completion.contributor.dart.label; | 5 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 6 | |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol | |
| 8 show Element, ElementKind; | |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' | |
| 10 hide Element, ElementKind; | |
| 11 import 'package:analysis_server/src/protocol_server.dart'; | 6 import 'package:analysis_server/src/protocol_server.dart'; |
| 12 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 7 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 13 import 'package:analysis_server/src/services/completion/dart/label_contributor.d
art'; | 8 import 'package:analysis_server/src/services/completion/dart/label_contributor.d
art'; |
| 14 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
| 15 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 16 | 11 |
| 17 import 'completion_contributor_util.dart'; | 12 import 'completion_contributor_util.dart'; |
| 18 | 13 |
| 19 main() { | 14 main() { |
| 20 defineReflectiveSuite(() { | 15 defineReflectiveSuite(() { |
| 21 defineReflectiveTests(LabelContributorTest); | 16 defineReflectiveTests(LabelContributorTest); |
| 22 defineReflectiveTests(LabelContributorTest_Driver); | 17 defineReflectiveTests(LabelContributorTest_Driver); |
| 23 }); | 18 }); |
| 24 } | 19 } |
| 25 | 20 |
| 26 @reflectiveTest | 21 @reflectiveTest |
| 27 class LabelContributorTest extends DartCompletionContributorTest { | 22 class LabelContributorTest extends DartCompletionContributorTest { |
| 28 CompletionSuggestion assertSuggestLabel(String name, | 23 CompletionSuggestion assertSuggestLabel(String name, |
| 29 {int relevance: DART_RELEVANCE_DEFAULT, | 24 {int relevance: DART_RELEVANCE_DEFAULT, |
| 30 CompletionSuggestionKind kind: CompletionSuggestionKind.IDENTIFIER}) { | 25 CompletionSuggestionKind kind: CompletionSuggestionKind.IDENTIFIER}) { |
| 31 CompletionSuggestion cs = | 26 CompletionSuggestion cs = |
| 32 assertSuggest(name, csKind: kind, relevance: relevance); | 27 assertSuggest(name, csKind: kind, relevance: relevance); |
| 33 expect(cs.returnType, isNull); | 28 expect(cs.returnType, isNull); |
| 34 protocol.Element element = cs.element; | 29 Element element = cs.element; |
| 35 expect(element, isNotNull); | 30 expect(element, isNotNull); |
| 36 expect(element.flags, 0); | 31 expect(element.flags, 0); |
| 37 expect(element.kind, equals(protocol.ElementKind.LABEL)); | 32 expect(element.kind, equals(ElementKind.LABEL)); |
| 38 expect(element.name, equals(name)); | 33 expect(element.name, equals(name)); |
| 39 expect(element.parameters, isNull); | 34 expect(element.parameters, isNull); |
| 40 expect(element.returnType, isNull); | 35 expect(element.returnType, isNull); |
| 41 assertHasNoParameterInfo(cs); | 36 assertHasNoParameterInfo(cs); |
| 42 return cs; | 37 return cs; |
| 43 } | 38 } |
| 44 | 39 |
| 45 @override | 40 @override |
| 46 DartCompletionContributor createContributor() { | 41 DartCompletionContributor createContributor() { |
| 47 return new LabelContributor(); | 42 return new LabelContributor(); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 await computeSuggestions(); | 319 await computeSuggestions(); |
| 325 assertSuggestLabel('foo'); | 320 assertSuggestLabel('foo'); |
| 326 } | 321 } |
| 327 } | 322 } |
| 328 | 323 |
| 329 @reflectiveTest | 324 @reflectiveTest |
| 330 class LabelContributorTest_Driver extends LabelContributorTest { | 325 class LabelContributorTest_Driver extends LabelContributorTest { |
| 331 @override | 326 @override |
| 332 bool get enableNewAnalysisDriver => true; | 327 bool get enableNewAnalysisDriver => true; |
| 333 } | 328 } |
| OLD | NEW |