| 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.completion.dart.util; | 5 library test.services.completion.dart.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 if (cs == null) { | 128 if (cs == null) { |
| 129 failedCompletion('expected $completion $csKind $elemKind', suggestions); | 129 failedCompletion('expected $completion $csKind $elemKind', suggestions); |
| 130 } | 130 } |
| 131 expect(cs.kind, equals(csKind)); | 131 expect(cs.kind, equals(csKind)); |
| 132 if (isDeprecated) { | 132 if (isDeprecated) { |
| 133 expect(cs.relevance, equals(DART_RELEVANCE_LOW)); | 133 expect(cs.relevance, equals(DART_RELEVANCE_LOW)); |
| 134 } else { | 134 } else { |
| 135 expect(cs.relevance, equals(relevance), reason: completion); | 135 expect(cs.relevance, equals(relevance), reason: completion); |
| 136 } | 136 } |
| 137 expect(cs.importUri, importUri); | 137 expect(cs.importUri, importUri); |
| 138 //TODO(pq): fix offset bug for trailing commas | 138 expect(cs.selectionOffset, equals(selectionOffset ?? completion.length)); |
| 139 // and replace w/ expect(cs.selectionOffset, equals(selectionOffset ?? compl
etion.length)); | |
| 140 if (selectionOffset != null) { | |
| 141 expect(cs.selectionOffset, equals(selectionOffset)); | |
| 142 } | |
| 143 expect(cs.selectionLength, equals(0)); | 139 expect(cs.selectionLength, equals(0)); |
| 144 expect(cs.isDeprecated, equals(isDeprecated)); | 140 expect(cs.isDeprecated, equals(isDeprecated)); |
| 145 expect(cs.isPotential, equals(isPotential)); | 141 expect(cs.isPotential, equals(isPotential)); |
| 146 if (cs.element != null) { | 142 if (cs.element != null) { |
| 147 expect(cs.element.location, isNotNull); | 143 expect(cs.element.location, isNotNull); |
| 148 expect(cs.element.location.file, isNotNull); | 144 expect(cs.element.location.file, isNotNull); |
| 149 expect(cs.element.location.offset, isNotNull); | 145 expect(cs.element.location.offset, isNotNull); |
| 150 expect(cs.element.location.length, isNotNull); | 146 expect(cs.element.location.length, isNotNull); |
| 151 expect(cs.element.location.startColumn, isNotNull); | 147 expect(cs.element.location.startColumn, isNotNull); |
| 152 expect(cs.element.location.startLine, isNotNull); | 148 expect(cs.element.location.startLine, isNotNull); |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 | 636 |
| 641 @override | 637 @override |
| 642 void setUp() { | 638 void setUp() { |
| 643 super.setUp(); | 639 super.setUp(); |
| 644 index = createMemoryIndex(); | 640 index = createMemoryIndex(); |
| 645 searchEngine = | 641 searchEngine = |
| 646 new SearchEngineImpl(index, (_) => new AstProviderForContext(context)); | 642 new SearchEngineImpl(index, (_) => new AstProviderForContext(context)); |
| 647 contributor = createContributor(); | 643 contributor = createContributor(); |
| 648 } | 644 } |
| 649 } | 645 } |
| OLD | NEW |