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

Unified Diff: pkg/analysis_server/test/services/completion/arglist_computer_test.dart

Issue 711533003: first cut argument list completion suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
Index: pkg/analysis_server/test/services/completion/arglist_computer_test.dart
diff --git a/pkg/analysis_server/test/services/completion/arglist_computer_test.dart b/pkg/analysis_server/test/services/completion/arglist_computer_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..beb66ea58eb8c747c2c2f7b3071f162db494dbf5
--- /dev/null
+++ b/pkg/analysis_server/test/services/completion/arglist_computer_test.dart
@@ -0,0 +1,117 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.services.completion.dart.arglist;
+
+import 'package:analysis_server/src/protocol.dart';
+import 'package:analysis_server/src/services/completion/arglist_computer.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../reflective_tests.dart';
+import 'completion_test_util.dart';
+
+main() {
+ groupSep = ' | ';
+ runReflectiveTests(ArgListComputerTest);
+}
+
+@ReflectiveTestCase()
+class ArgListComputerTest extends AbstractCompletionTest {
+
+ @override
+ void setUp() {
+ super.setUp();
+ computer = new ArgListComputer();
+ }
+
+ test_ArgumentList_imported_function_0() {
+ // ArgumentList MethodInvocation ExpressionStatement Block
+ addSource('/libA.dart', '''
+ library A;
+ bool hasLength(int expected) { }
+ expect() { }
+ void baz() { }''');
+ addTestSource('''
+ import '/libA.dart'
+ class B { }
+ String bar() => true;
+ void main() {expect(^)}''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
+ });
+ }
+
+// test_ArgumentList_imported_function_1() {
+// // ArgumentList MethodInvocation ExpressionStatement Block
+// addSource('/libA.dart', '''
+// library A;
+// bool hasLength(int expected) { }
+// expect(String arg) { }
+// void baz() { }''');
+// addTestSource('''
+// import '/libA.dart'
+// class B { }
+// String bar() => true;
+// void main() {expect(^)}''');
+// computeFast();
+// return computeFull(true).then((_) {
+// assertSuggestArgumentList(['arg'], ['String']);
+// });
+// }
+
+ test_ArgumentList_local_function_1() {
+ // ArgumentList MethodInvocation ExpressionStatement Block
+ addSource('/libA.dart', '''
+ library A;
+ bool hasLength(int expected) { }
+ void baz() { }''');
+ addTestSource('''
+ import '/libA.dart'
+ expect(arg) { }
+ class B { }
+ String bar() => true;
+ void main() {expect(^)}''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertSuggestArgumentList(['arg'], ['dynamic']);
+ });
+ }
+
+ test_ArgumentList_local_method_0() {
+ // ArgumentList MethodInvocation ExpressionStatement Block
+ addSource('/libA.dart', '''
+ library A;
+ bool hasLength(int expected) { }
+ void baz() { }''');
+ addTestSource('''
+ import '/libA.dart'
+ class B {
+ expect() { }
+ void foo() {expect(^)}}
+ String bar() => true;''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
+ });
+ }
+
+ test_ArgumentList_local_method_2() {
+ // ArgumentList MethodInvocation ExpressionStatement Block
+ addSource('/libA.dart', '''
+ library A;
+ bool hasLength(int expected) { }
+ void baz() { }''');
+ addTestSource('''
+ import '/libA.dart'
+ class B {
+ expect(arg, int blat) { }
+ void foo() {expect(^)}}
+ String bar() => true;''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertSuggestArgumentList(['arg', 'blat'], ['dynamic', 'int']);
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698