| 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.computer.dart.relevance; | 5 library test.services.completion.computer.dart.relevance; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/analysis_server.dart' | 10 import 'package:analysis_server/src/analysis_server.dart' |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 expect(replacementOffset, equals(completionOffset)); | 165 expect(replacementOffset, equals(completionOffset)); |
| 166 expect(replacementLength, equals(0)); | 166 expect(replacementLength, equals(0)); |
| 167 assertHasResult(CompletionSuggestionKind.INVOCATION, 's1'); | 167 assertHasResult(CompletionSuggestionKind.INVOCATION, 's1'); |
| 168 assertHasResult( | 168 assertHasResult( |
| 169 CompletionSuggestionKind.INVOCATION, 's2', DART_RELEVANCE_COMMON_USAGE); | 169 CompletionSuggestionKind.INVOCATION, 's2', DART_RELEVANCE_COMMON_USAGE); |
| 170 assertNoResult('Future'); | 170 assertNoResult('Future'); |
| 171 assertNoResult('Object'); | 171 assertNoResult('Object'); |
| 172 assertNoResult('A'); | 172 assertNoResult('A'); |
| 173 } | 173 } |
| 174 | 174 |
| 175 test_PrefixedIdentifier_field_inPart() async { |
| 176 // SimpleIdentifier PrefixedIdentifeir ExpressionStatement |
| 177 addFile('/project/bin/myLib.dart', |
| 178 'library L; part "$testFile"; class A {static int s2;}'); |
| 179 addTestFile('part of L; foo() {A.^}'); |
| 180 await getSuggestions({ |
| 181 'L.A': ['s2'] |
| 182 }); |
| 183 expect(replacementOffset, equals(completionOffset)); |
| 184 expect(replacementLength, equals(0)); |
| 185 assertHasResult( |
| 186 CompletionSuggestionKind.INVOCATION, 's2', DART_RELEVANCE_COMMON_USAGE); |
| 187 assertNoResult('Future'); |
| 188 assertNoResult('Object'); |
| 189 assertNoResult('A'); |
| 190 } |
| 191 |
| 175 test_PrefixedIdentifier_getter() async { | 192 test_PrefixedIdentifier_getter() async { |
| 176 // SimpleIdentifier PrefixedIdentifeir ExpressionStatement | 193 // SimpleIdentifier PrefixedIdentifeir ExpressionStatement |
| 177 addTestFile('class A {int get g1 => 1; int get g2 => 2; x() {new A().^}}'); | 194 addTestFile('class A {int get g1 => 1; int get g2 => 2; x() {new A().^}}'); |
| 178 await getSuggestions({ | 195 await getSuggestions({ |
| 179 '.A': ['g2'] | 196 '.A': ['g2'] |
| 180 }); | 197 }); |
| 181 expect(replacementOffset, equals(completionOffset)); | 198 expect(replacementOffset, equals(completionOffset)); |
| 182 expect(replacementLength, equals(0)); | 199 expect(replacementLength, equals(0)); |
| 183 assertHasResult(CompletionSuggestionKind.INVOCATION, 'g1'); | 200 assertHasResult(CompletionSuggestionKind.INVOCATION, 'g1'); |
| 184 assertHasResult( | 201 assertHasResult( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextBool'); | 247 assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextBool'); |
| 231 assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextDouble', | 248 assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextDouble', |
| 232 DART_RELEVANCE_COMMON_USAGE - 1); | 249 DART_RELEVANCE_COMMON_USAGE - 1); |
| 233 assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextInt', | 250 assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextInt', |
| 234 DART_RELEVANCE_COMMON_USAGE); | 251 DART_RELEVANCE_COMMON_USAGE); |
| 235 assertNoResult('Random'); | 252 assertNoResult('Random'); |
| 236 assertNoResult('Object'); | 253 assertNoResult('Object'); |
| 237 assertNoResult('A'); | 254 assertNoResult('A'); |
| 238 } | 255 } |
| 239 } | 256 } |
| OLD | NEW |