| 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.target; | 5 library test.services.completion.target; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/services/completion/completion_target.dart'; | 7 import 'package:analysis_server/src/services/completion/completion_target.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 addTestSource('class A {var b; X _c; foo() {var a; (a as ^String).foo();}'); | 131 addTestSource('class A {var b; X _c; foo() {var a; (a as ^String).foo();}'); |
| 132 assertTarget('String', 'a as String'); | 132 assertTarget('String', 'a as String'); |
| 133 } | 133 } |
| 134 | 134 |
| 135 test_Block() { | 135 test_Block() { |
| 136 // Block | 136 // Block |
| 137 addTestSource('main() {^}'); | 137 addTestSource('main() {^}'); |
| 138 assertTarget('}', '{}'); | 138 assertTarget('}', '{}'); |
| 139 } | 139 } |
| 140 | 140 |
| 141 test_FormalParameter_partialType() { |
| 142 // SimpleIdentifier PrefixedIdentifier TypeName |
| 143 addTestSource('foo(b.^ f) { }'); |
| 144 assertTarget('f', 'b.f'); |
| 145 } |
| 146 |
| 147 test_FormalParameter_partialType2() { |
| 148 // SimpleIdentifier PrefixedIdentifier TypeName |
| 149 addTestSource('foo(b.z^ f) { }'); |
| 150 assertTarget('z', 'b.z'); |
| 151 } |
| 152 |
| 153 test_FormalParameter_partialType3() { |
| 154 // SimpleIdentifier PrefixedIdentifier TypeName |
| 155 addTestSource('foo(b.^) { }'); |
| 156 assertTarget('', 'b.'); |
| 157 } |
| 158 |
| 159 test_FormalParameterList() { |
| 160 // Token FormalParameterList FunctionExpression |
| 161 addTestSource('foo(^) { }'); |
| 162 assertTarget(')', '()'); |
| 163 } |
| 164 |
| 141 test_FunctionDeclaration_inLineComment() { | 165 test_FunctionDeclaration_inLineComment() { |
| 142 // Comment CompilationUnit | 166 // Comment CompilationUnit |
| 143 addTestSource(''' | 167 addTestSource(''' |
| 144 // normal comment ^ | 168 // normal comment ^ |
| 145 zoo(z) { } String name;'''); | 169 zoo(z) { } String name;'''); |
| 146 assertTarget('// normal comment ', 'zoo(z) {} String name;'); | 170 assertTarget('// normal comment ', 'zoo(z) {} String name;'); |
| 147 } | 171 } |
| 148 | 172 |
| 149 test_FunctionDeclaration_inLineComment2() { | 173 test_FunctionDeclaration_inLineComment2() { |
| 150 // Comment CompilationUnit | 174 // Comment CompilationUnit |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 addTestSource('main() {int b^ = 1;}'); | 515 addTestSource('main() {int b^ = 1;}'); |
| 492 assertTarget('b = 1', 'int b = 1'); | 516 assertTarget('b = 1', 'int b = 1'); |
| 493 } | 517 } |
| 494 | 518 |
| 495 test_VariableDeclaration_lhs_identifier_before() { | 519 test_VariableDeclaration_lhs_identifier_before() { |
| 496 // VariableDeclaration VariableDeclarationList | 520 // VariableDeclaration VariableDeclarationList |
| 497 addTestSource('main() {int ^b = 1;}'); | 521 addTestSource('main() {int ^b = 1;}'); |
| 498 assertTarget('b = 1', 'int b = 1'); | 522 assertTarget('b = 1', 'int b = 1'); |
| 499 } | 523 } |
| 500 } | 524 } |
| OLD | NEW |