Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Unified Diff: pkg/analysis_server/test/completion_test.dart

Issue 422133002: add FUNCTION_TYPE_ALIAS to CompletionSuggestionKind (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_services/lib/completion/completion_suggestion.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/completion_test.dart
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index 477cecfa41fd842ac63273a47314d5aef1fe4bf2..4c24a026bebe9ea88a6b4ebdda2dca9a8de3d8df 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -17,6 +17,7 @@ import 'package:analysis_testing/reflective_tests.dart';
import 'package:unittest/unittest.dart';
import 'analysis_abstract.dart';
+import 'package:analysis_server/src/domain_analysis.dart';
main() {
groupSep = ' | ';
@@ -40,9 +41,9 @@ class CompletionTest extends AbstractAnalysisTest {
+ content.substring(completionOffset + 1));
}
- void assertHasResult(CompletionSuggestionKind kind,
- CompletionRelevance relevance, String completion,
- bool isDeprecated, bool isPotential) {
+ void assertHasResult(CompletionSuggestionKind kind, String completion,
+ [CompletionRelevance relevance = CompletionRelevance.DEFAULT,
+ bool isDeprecated = false, bool isPotential = false]) {
var cs = suggestions.firstWhere((cs) => cs.completion == completion, orElse: () {
var completions = suggestions.map((s) => s.completion).toList();
fail('expected "$completion" but found\n $completions');
@@ -55,6 +56,12 @@ class CompletionTest extends AbstractAnalysisTest {
expect(cs.isPotential, equals(isPotential));
}
+ void assertNoResult(String completion) {
+ if (suggestions.any((cs) => cs.completion == completion)) {
+ fail('did not expect completion: $completion');
+ }
+ }
+
void assertValidId(String id) {
expect(id, isNotNull);
expect(id.isNotEmpty, isTrue);
@@ -107,16 +114,28 @@ class CompletionTest extends AbstractAnalysisTest {
return new Future.delayed(Duration.ZERO, waitForSuggestions);
}
- test_suggestions() {
+ test_suggestions_importedType() {
addTestFile('''
import 'dart:html';
main() {^}
''');
return getSuggestions().then((_) {
- assertHasResult(CompletionSuggestionKind.CLASS,
- CompletionRelevance.DEFAULT, 'Object', false, false);
- assertHasResult(CompletionSuggestionKind.CLASS,
- CompletionRelevance.DEFAULT, 'HtmlElement', false, false);
+ assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
+ assertHasResult(CompletionSuggestionKind.CLASS, 'HtmlElement');
+ assertNoResult('test');
+ });
+ }
+
+ test_suggestions_topLevel() {
+ addTestFile('''
+ typedef foo();
+ var test^ = '';
+ main() {test.}
+ ''');
+ return getSuggestions().then((_) {
+ assertHasResult(CompletionSuggestionKind.CLASS, 'Object');
+ assertHasResult(CompletionSuggestionKind.TOP_LEVEL_VARIABLE, 'test');
+ assertNoResult('HtmlElement');
});
}
}
« no previous file with comments | « no previous file | pkg/analysis_services/lib/completion/completion_suggestion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698