| 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.dart.local; | 5 library test.services.completion.dart.local; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/services/completion/local_computer.dart'; | 7 import 'package:analysis_server/src/services/completion/local_computer.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 test_FunctionExpression_body_function() { | 27 test_FunctionExpression_body_function() { |
| 28 // Block BlockFunctionBody FunctionExpression | 28 // Block BlockFunctionBody FunctionExpression |
| 29 addTestSource('String foo(List args) {x.then((R b) {^});}'); | 29 addTestSource('String foo(List args) {x.then((R b) {^});}'); |
| 30 expect(computeFast(), isTrue); | 30 expect(computeFast(), isTrue); |
| 31 var f = assertSuggestFunction('foo', 'String', false); | 31 var f = assertSuggestFunction('foo', 'String', false); |
| 32 expect(f.element.isPrivate, isFalse); | 32 expect(f.element.isPrivate, isFalse); |
| 33 assertSuggestParameter('args', 'List'); | 33 assertSuggestParameter('args', 'List'); |
| 34 assertSuggestParameter('b', 'R'); | 34 assertSuggestParameter('b', 'R'); |
| 35 } | 35 } |
| 36 | 36 |
| 37 test_InterpolationExpression() { | |
| 38 // SimpleIdentifier InterpolationExpression StringInterpolation | |
| 39 addTestSource('main() {String name; print("hello \$^");}'); | |
| 40 expect(computeFast(), isTrue); | |
| 41 assertSuggestLocalVariable('name', 'String'); | |
| 42 } | |
| 43 | |
| 44 test_InterpolationExpression_block() { | |
| 45 // SimpleIdentifier InterpolationExpression StringInterpolation | |
| 46 addTestSource('main() {String name; print("hello \${n^}");}'); | |
| 47 expect(computeFast(), isTrue); | |
| 48 assertSuggestLocalVariable('name', 'String'); | |
| 49 } | |
| 50 | |
| 51 test_MethodDeclaration_body_getters() { | 37 test_MethodDeclaration_body_getters() { |
| 52 // Block BlockFunctionBody MethodDeclaration | 38 // Block BlockFunctionBody MethodDeclaration |
| 53 addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}'); | 39 addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}'); |
| 54 expect(computeFast(), isTrue); | 40 expect(computeFast(), isTrue); |
| 55 var a = assertSuggestMethod('a', 'A', 'Z'); | 41 var a = assertSuggestMethod('a', 'A', 'Z'); |
| 56 expect(a.element.isDeprecated, isFalse); | 42 expect(a.element.isDeprecated, isFalse); |
| 57 expect(a.element.isPrivate, isFalse); | 43 expect(a.element.isPrivate, isFalse); |
| 58 var f = assertSuggestGetter('f', 'X'); | 44 var f = assertSuggestGetter('f', 'X'); |
| 59 expect(f.element.isDeprecated, isTrue); | 45 expect(f.element.isDeprecated, isTrue); |
| 60 expect(f.element.isPrivate, isFalse); | 46 expect(f.element.isPrivate, isFalse); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 91 | 77 |
| 92 test_MethodDeclaration_parameters_positional() { | 78 test_MethodDeclaration_parameters_positional() { |
| 93 // Block BlockFunctionBody MethodDeclaration | 79 // Block BlockFunctionBody MethodDeclaration |
| 94 addTestSource('class A {Z a(X x, [int y=1]) {^}}'); | 80 addTestSource('class A {Z a(X x, [int y=1]) {^}}'); |
| 95 expect(computeFast(), isTrue); | 81 expect(computeFast(), isTrue); |
| 96 assertSuggestMethod('a', 'A', 'Z'); | 82 assertSuggestMethod('a', 'A', 'Z'); |
| 97 assertSuggestParameter('x', 'X'); | 83 assertSuggestParameter('x', 'X'); |
| 98 assertSuggestParameter('y', 'int'); | 84 assertSuggestParameter('y', 'int'); |
| 99 } | 85 } |
| 100 } | 86 } |
| OLD | NEW |