| 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/src/protocol.dart' as protocol show Element, | 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, |
| 10 ElementKind; | 10 ElementKind; |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 } | 667 } |
| 668 | 668 |
| 669 test_ArgumentList() { | 669 test_ArgumentList() { |
| 670 // ArgumentList MethodInvocation ExpressionStatement Block | 670 // ArgumentList MethodInvocation ExpressionStatement Block |
| 671 addSource('/libA.dart', ''' | 671 addSource('/libA.dart', ''' |
| 672 library A; | 672 library A; |
| 673 bool hasLength(int expected) { } | 673 bool hasLength(int expected) { } |
| 674 void baz() { }'''); | 674 void baz() { }'''); |
| 675 addTestSource(''' | 675 addTestSource(''' |
| 676 import '/libA.dart' | 676 import '/libA.dart' |
| 677 class B { } |
| 677 String bar() => true; | 678 String bar() => true; |
| 678 void main() {expect(^)}'''); | 679 void main() {expect(^)}'''); |
| 679 computeFast(); | 680 computeFast(); |
| 680 return computeFull(true).then((_) { | 681 return computeFull(true).then((_) { |
| 681 assertSuggestLocalFunction('bar', 'String'); | 682 assertSuggestLocalFunction('bar', 'String'); |
| 682 assertSuggestImportedFunction('hasLength', 'bool'); | 683 assertSuggestImportedFunction('hasLength', 'bool'); |
| 684 assertSuggestImportedFunction('identical', 'bool'); |
| 685 assertSuggestLocalClass('B'); |
| 686 assertSuggestImportedClass('Object'); |
| 683 assertNotSuggested('main'); | 687 assertNotSuggested('main'); |
| 684 assertNotSuggested('baz'); | 688 assertNotSuggested('baz'); |
| 689 assertNotSuggested('print'); |
| 685 }); | 690 }); |
| 686 } | 691 } |
| 687 | 692 |
| 688 test_ArgumentList_namedParam() { | 693 test_ArgumentList_namedParam() { |
| 689 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation | 694 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation |
| 690 // ExpressionStatement | 695 // ExpressionStatement |
| 691 addSource('/libA.dart', ''' | 696 addSource('/libA.dart', ''' |
| 692 library A; | 697 library A; |
| 693 bool hasLength(int expected) { }'''); | 698 bool hasLength(int expected) { }'''); |
| 694 addTestSource(''' | 699 addTestSource(''' |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 return computeFull(true).then((_) { | 1594 return computeFull(true).then((_) { |
| 1590 assertSuggestLocalFunction('foo', null); | 1595 assertSuggestLocalFunction('foo', null); |
| 1591 assertSuggestLocalFunction('bar', 'void'); | 1596 assertSuggestLocalFunction('bar', 'void'); |
| 1592 assertSuggestLocalMethod('a', 'A', 'Z'); | 1597 assertSuggestLocalMethod('a', 'A', 'Z'); |
| 1593 assertSuggestParameter('x', 'X'); | 1598 assertSuggestParameter('x', 'X'); |
| 1594 assertSuggestParameter('y', 'int'); | 1599 assertSuggestParameter('y', 'int'); |
| 1595 assertSuggestImportedClass('String'); | 1600 assertSuggestImportedClass('String'); |
| 1596 }); | 1601 }); |
| 1597 } | 1602 } |
| 1598 | 1603 |
| 1604 test_FormalParameterList() { |
| 1605 // FormalParameterList MethodDeclaration |
| 1606 addTestSource(''' |
| 1607 foo() { } |
| 1608 void bar() { } |
| 1609 class A {a(^) { }}'''); |
| 1610 computeFast(); |
| 1611 return computeFull(true).then((_) { |
| 1612 assertSuggestLocalFunction('foo', null); |
| 1613 assertSuggestLocalMethod('a', 'A', null); |
| 1614 assertSuggestLocalClass('A'); |
| 1615 assertSuggestImportedClass('String'); |
| 1616 assertSuggestImportedFunction('identical', 'bool'); |
| 1617 assertNotSuggested('bar'); |
| 1618 }); |
| 1619 } |
| 1620 |
| 1599 test_MethodInvocation_no_semicolon() { | 1621 test_MethodInvocation_no_semicolon() { |
| 1600 // MethodInvocation ExpressionStatement Block | 1622 // MethodInvocation ExpressionStatement Block |
| 1601 addTestSource(''' | 1623 addTestSource(''' |
| 1602 main() { } | 1624 main() { } |
| 1603 class I {X get f => new A();get _g => new A();} | 1625 class I {X get f => new A();get _g => new A();} |
| 1604 class A implements I { | 1626 class A implements I { |
| 1605 var b; X _c; | 1627 var b; X _c; |
| 1606 X get d => new A();get _e => new A(); | 1628 X get d => new A();get _e => new A(); |
| 1607 // no semicolon between completion point and next statement | 1629 // no semicolon between completion point and next statement |
| 1608 set s1(I x) {} set _s2(I x) {x.^ m(null);} | 1630 set s1(I x) {} set _s2(I x) {x.^ m(null);} |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 assertNotSuggested('bar2'); | 1947 assertNotSuggested('bar2'); |
| 1926 assertNotSuggested('_B'); | 1948 assertNotSuggested('_B'); |
| 1927 assertSuggestLocalClass('Y'); | 1949 assertSuggestLocalClass('Y'); |
| 1928 assertSuggestLocalClass('C'); | 1950 assertSuggestLocalClass('C'); |
| 1929 assertSuggestLocalVariable('f', null); | 1951 assertSuggestLocalVariable('f', null); |
| 1930 assertNotSuggested('x'); | 1952 assertNotSuggested('x'); |
| 1931 assertNotSuggested('e'); | 1953 assertNotSuggested('e'); |
| 1932 }); | 1954 }); |
| 1933 } | 1955 } |
| 1934 } | 1956 } |
| OLD | NEW |