| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library test.services.completion.dart.arglist; |
| 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; |
| 9 import 'package:unittest/unittest.dart'; |
| 10 |
| 11 import '../../reflective_tests.dart'; |
| 12 import 'completion_test_util.dart'; |
| 13 |
| 14 main() { |
| 15 groupSep = ' | '; |
| 16 runReflectiveTests(ArgListComputerTest); |
| 17 } |
| 18 |
| 19 @ReflectiveTestCase() |
| 20 class ArgListComputerTest extends AbstractCompletionTest { |
| 21 |
| 22 @override |
| 23 void setUp() { |
| 24 super.setUp(); |
| 25 computer = new ArgListComputer(); |
| 26 } |
| 27 |
| 28 test_ArgumentList_imported_function_0() { |
| 29 // ArgumentList MethodInvocation ExpressionStatement Block |
| 30 addSource('/libA.dart', ''' |
| 31 library A; |
| 32 bool hasLength(int expected) { } |
| 33 expect() { } |
| 34 void baz() { }'''); |
| 35 addTestSource(''' |
| 36 import '/libA.dart' |
| 37 class B { } |
| 38 String bar() => true; |
| 39 void main() {expect(^)}'''); |
| 40 computeFast(); |
| 41 return computeFull(true).then((_) { |
| 42 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
| 43 }); |
| 44 } |
| 45 |
| 46 // test_ArgumentList_imported_function_1() { |
| 47 // // ArgumentList MethodInvocation ExpressionStatement Block |
| 48 // addSource('/libA.dart', ''' |
| 49 // library A; |
| 50 // bool hasLength(int expected) { } |
| 51 // expect(String arg) { } |
| 52 // void baz() { }'''); |
| 53 // addTestSource(''' |
| 54 // import '/libA.dart' |
| 55 // class B { } |
| 56 // String bar() => true; |
| 57 // void main() {expect(^)}'''); |
| 58 // computeFast(); |
| 59 // return computeFull(true).then((_) { |
| 60 // assertSuggestArgumentList(['arg'], ['String']); |
| 61 // }); |
| 62 // } |
| 63 |
| 64 test_ArgumentList_local_function_1() { |
| 65 // ArgumentList MethodInvocation ExpressionStatement Block |
| 66 addSource('/libA.dart', ''' |
| 67 library A; |
| 68 bool hasLength(int expected) { } |
| 69 void baz() { }'''); |
| 70 addTestSource(''' |
| 71 import '/libA.dart' |
| 72 expect(arg) { } |
| 73 class B { } |
| 74 String bar() => true; |
| 75 void main() {expect(^)}'''); |
| 76 computeFast(); |
| 77 return computeFull(true).then((_) { |
| 78 assertSuggestArgumentList(['arg'], ['dynamic']); |
| 79 }); |
| 80 } |
| 81 |
| 82 test_ArgumentList_local_method_0() { |
| 83 // ArgumentList MethodInvocation ExpressionStatement Block |
| 84 addSource('/libA.dart', ''' |
| 85 library A; |
| 86 bool hasLength(int expected) { } |
| 87 void baz() { }'''); |
| 88 addTestSource(''' |
| 89 import '/libA.dart' |
| 90 class B { |
| 91 expect() { } |
| 92 void foo() {expect(^)}} |
| 93 String bar() => true;'''); |
| 94 computeFast(); |
| 95 return computeFull(true).then((_) { |
| 96 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
| 97 }); |
| 98 } |
| 99 |
| 100 test_ArgumentList_local_method_2() { |
| 101 // ArgumentList MethodInvocation ExpressionStatement Block |
| 102 addSource('/libA.dart', ''' |
| 103 library A; |
| 104 bool hasLength(int expected) { } |
| 105 void baz() { }'''); |
| 106 addTestSource(''' |
| 107 import '/libA.dart' |
| 108 class B { |
| 109 expect(arg, int blat) { } |
| 110 void foo() {expect(^)}} |
| 111 String bar() => true;'''); |
| 112 computeFast(); |
| 113 return computeFull(true).then((_) { |
| 114 assertSuggestArgumentList(['arg', 'blat'], ['dynamic', 'int']); |
| 115 }); |
| 116 } |
| 117 } |
| OLD | NEW |