| 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'; |
| 11 import 'completion_test_util.dart'; | 11 import 'completion_test_util.dart'; |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 groupSep = ' | '; | 14 groupSep = ' | '; |
| 15 runReflectiveTests(LocalComputerTest); | 15 runReflectiveTests(LocalComputerTest); |
| 16 } | 16 } |
| 17 | 17 |
| 18 @ReflectiveTestCase() | 18 @ReflectiveTestCase() |
| 19 class LocalComputerTest extends AbstractSelectorSuggestionTest { | 19 class LocalComputerTest extends AbstractSelectorSuggestionTest { |
| 20 | 20 |
| 21 @override | 21 @override |
| 22 void setUp() { | 22 void setUp() { |
| 23 super.setUp(); | 23 super.setUp(); |
| 24 computer = new LocalComputer(); | 24 computer = new LocalComputer(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 test_BinaryExpression_LHS() { | |
| 28 // SimpleIdentifier BinaryExpression VariableDeclaration | |
| 29 // VariableDeclarationList VariableDeclarationStatement | |
| 30 addTestSource('main() {int a = 1, b = ^ + 2;}'); | |
| 31 expect(computeFast(), isTrue); | |
| 32 assertSuggestLocalVariable('a', 'int'); | |
| 33 assertNotSuggested('b'); | |
| 34 } | |
| 35 | |
| 36 test_BinaryExpression_RHS() { | |
| 37 // SimpleIdentifier BinaryExpression VariableDeclaration | |
| 38 // VariableDeclarationList VariableDeclarationStatement | |
| 39 addTestSource('main() {int a = 1, b = 2 + ^;}'); | |
| 40 expect(computeFast(), isTrue); | |
| 41 assertSuggestLocalVariable('a', 'int'); | |
| 42 assertNotSuggested('b'); | |
| 43 } | |
| 44 | |
| 45 test_CatchClause_typed() { | 27 test_CatchClause_typed() { |
| 46 // Block CatchClause TryStatement | 28 // Block CatchClause TryStatement |
| 47 addTestSource('class A {a() {try{} on E catch (e) {^}}}'); | 29 addTestSource('class A {a() {try{} on E catch (e) {^}}}'); |
| 48 expect(computeFast(), isTrue); | 30 expect(computeFast(), isTrue); |
| 49 assertSuggestParameter('e', 'E'); | 31 assertSuggestParameter('e', 'E'); |
| 50 } | 32 } |
| 51 | 33 |
| 52 test_CatchClause_untyped() { | 34 test_CatchClause_untyped() { |
| 53 // Block CatchClause TryStatement | 35 // Block CatchClause TryStatement |
| 54 addTestSource('class A {a() {try{} catch (e, s) {^}}}'); | 36 addTestSource('class A {a() {try{} catch (e, s) {^}}}'); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 184 |
| 203 test_MethodDeclaration_parameters_positional() { | 185 test_MethodDeclaration_parameters_positional() { |
| 204 // Block BlockFunctionBody MethodDeclaration | 186 // Block BlockFunctionBody MethodDeclaration |
| 205 addTestSource('class A {Z a(X x, [int y=1]) {^}}'); | 187 addTestSource('class A {Z a(X x, [int y=1]) {^}}'); |
| 206 expect(computeFast(), isTrue); | 188 expect(computeFast(), isTrue); |
| 207 assertSuggestMethod('a', 'A', 'Z'); | 189 assertSuggestMethod('a', 'A', 'Z'); |
| 208 assertSuggestParameter('x', 'X'); | 190 assertSuggestParameter('x', 'X'); |
| 209 assertSuggestParameter('y', 'int'); | 191 assertSuggestParameter('y', 'int'); |
| 210 } | 192 } |
| 211 } | 193 } |
| OLD | NEW |