| 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:analysis_testing/reflective_tests.dart'; | 8 import 'package:analysis_testing/reflective_tests.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 test_field_name() { | 62 test_field_name() { |
| 63 addTestSource('class A {B ^}}'); | 63 addTestSource('class A {B ^}}'); |
| 64 expect(computeFast(), isTrue); | 64 expect(computeFast(), isTrue); |
| 65 assertNotSuggested('A'); | 65 assertNotSuggested('A'); |
| 66 } | 66 } |
| 67 | 67 |
| 68 test_field_name2() { | 68 test_field_name2() { |
| 69 addTestSource('class A {var ^}}'); | 69 addTestSource('class A {var ^}}'); |
| 70 expect(computeFast(), isTrue); | 70 expect(computeFast(), isTrue); |
| 71 //TODO (danrubel) should not be suggested | 71 assertNotSuggested('A'); |
| 72 // but var ^ in this test | |
| 73 // parses differently than B ^ in test above | |
| 74 assertSuggestClass('A'); | |
| 75 } | 72 } |
| 76 | 73 |
| 77 test_for() { | 74 test_for() { |
| 78 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}'); | 75 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}'); |
| 79 expect(computeFast(), isTrue); | 76 expect(computeFast(), isTrue); |
| 80 assertSuggestLocalVariable('i'); | 77 assertSuggestLocalVariable('i'); |
| 81 } | 78 } |
| 82 | 79 |
| 83 test_forEach() { | 80 test_forEach() { |
| 84 addTestSource('main(args) {for (foo in bar) {^}}'); | 81 addTestSource('main(args) {for (foo in bar) {^}}'); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 136 |
| 140 test_topLevelVar_name() { | 137 test_topLevelVar_name() { |
| 141 addTestSource('class A {} B ^'); | 138 addTestSource('class A {} B ^'); |
| 142 expect(computeFast(), isTrue); | 139 expect(computeFast(), isTrue); |
| 143 assertNotSuggested('A'); | 140 assertNotSuggested('A'); |
| 144 } | 141 } |
| 145 | 142 |
| 146 test_topLevelVar_name2() { | 143 test_topLevelVar_name2() { |
| 147 addTestSource('class A {} var ^'); | 144 addTestSource('class A {} var ^'); |
| 148 expect(computeFast(), isTrue); | 145 expect(computeFast(), isTrue); |
| 149 // TODO (danrubel) should not be suggested | 146 assertNotSuggested('A'); |
| 150 // but var ^ in this test | |
| 151 // parses differently than B ^ in test above | |
| 152 assertSuggestClass('A'); | |
| 153 } | 147 } |
| 154 | 148 |
| 155 test_variableDeclaration() { | 149 test_variableDeclaration() { |
| 156 addTestSource('main() {int a = 1, b = 2 + ^;}'); | 150 addTestSource('main() {int a = 1, b = 2 + ^;}'); |
| 157 expect(computeFast(), isTrue); | 151 expect(computeFast(), isTrue); |
| 158 assertSuggestLocalVariable('a'); | 152 assertSuggestLocalVariable('a'); |
| 159 assertNotSuggested('b'); | 153 assertNotSuggested('b'); |
| 160 } | 154 } |
| 161 } | 155 } |
| OLD | NEW |