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.util; | 5 library test.services.completion.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void addTestSource(String content) { | 57 void addTestSource(String content) { |
58 expect(completionOffset, isNull, reason: 'Call addTestUnit exactly once'); | 58 expect(completionOffset, isNull, reason: 'Call addTestUnit exactly once'); |
59 completionOffset = content.indexOf('^'); | 59 completionOffset = content.indexOf('^'); |
60 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^'); | 60 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^'); |
61 int nextOffset = content.indexOf('^', completionOffset + 1); | 61 int nextOffset = content.indexOf('^', completionOffset + 1); |
62 expect(nextOffset, equals(-1), reason: 'too many ^'); | 62 expect(nextOffset, equals(-1), reason: 'too many ^'); |
63 content = content.substring(0, completionOffset) + | 63 content = content.substring(0, completionOffset) + |
64 content.substring(completionOffset + 1); | 64 content.substring(completionOffset + 1); |
65 testSource = addSource(testFile, content); | 65 testSource = addSource(testFile, content); |
66 cache = new DartCompletionCache(context, testSource); | 66 cache = new DartCompletionCache(context, testSource); |
67 request = new DartCompletionRequest(context, provider, searchEngine, | 67 request = new DartCompletionRequest( |
68 testSource, completionOffset, cache); | 68 context, provider, searchEngine, testSource, completionOffset, cache); |
69 } | 69 } |
70 | 70 |
71 void assertHasNoParameterInfo(CompletionSuggestion suggestion) { | 71 void assertHasNoParameterInfo(CompletionSuggestion suggestion) { |
72 expect(suggestion.parameterNames, isNull); | 72 expect(suggestion.parameterNames, isNull); |
73 expect(suggestion.parameterTypes, isNull); | 73 expect(suggestion.parameterTypes, isNull); |
74 expect(suggestion.requiredParameterCount, isNull); | 74 expect(suggestion.requiredParameterCount, isNull); |
75 expect(suggestion.hasNamedParameters, isNull); | 75 expect(suggestion.hasNamedParameters, isNull); |
76 } | 76 } |
77 | 77 |
78 void assertHasParameterInfo(CompletionSuggestion suggestion) { | 78 void assertHasParameterInfo(CompletionSuggestion suggestion) { |
(...skipping 4637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4716 assertNotSuggested('bar2'); | 4716 assertNotSuggested('bar2'); |
4717 assertNotSuggested('_B'); | 4717 assertNotSuggested('_B'); |
4718 assertSuggestLocalClass('Y'); | 4718 assertSuggestLocalClass('Y'); |
4719 assertSuggestLocalClass('C'); | 4719 assertSuggestLocalClass('C'); |
4720 assertSuggestLocalVariable('f', null); | 4720 assertSuggestLocalVariable('f', null); |
4721 assertNotSuggested('x'); | 4721 assertNotSuggested('x'); |
4722 assertNotSuggested('e'); | 4722 assertNotSuggested('e'); |
4723 }); | 4723 }); |
4724 } | 4724 } |
4725 } | 4725 } |
OLD | NEW |